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

Module serializer.
  (*
  fn write_as_uleb128<T1, T2>(binary: &mut BinaryData, x: T1, max: T2) -> Result<()>
  where
      T1: Into<u64>,
      T2: Into<u64>,
  {
      let x: u64 = x.into();
      let max: u64 = max.into();
      if x > max {
          bail!("value ({}) cannot exceed ({})", x, max)
      }
      write_u64_as_uleb128(binary, x)
  }
  *)
  Definition write_as_uleb128 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [ T1; T2 ], [ binary; x; max ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let x := M.alloc (| x |) in
        let max := M.alloc (| max |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ x :=
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::convert::Into",
                      T1,
                      [ Ty.path "u64" ],
                      "into",
                      []
                    |),
                    [ M.read (| x |) ]
                  |)
                |) in
              let~ max :=
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::convert::Into",
                      T2,
                      [ Ty.path "u64" ],
                      "into",
                      []
                    |),
                    [ M.read (| max |) ]
                  |)
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use (M.alloc (| BinOp.gt (| M.read (| x |), M.read (| max |) |) |)) 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 "anyhow::Error",
                                        "msg",
                                        [ Ty.path "alloc::string::String" ]
                                      |),
                                      [
                                        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 "value (" |);
                                                                M.read (|
                                                                  Value.String ") cannot exceed ("
                                                                |);
                                                                M.read (| Value.String ")" |)
                                                              ]
                                                          |);
                                                          M.alloc (|
                                                            Value.Array
                                                              [
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path
                                                                      "core::fmt::rt::Argument",
                                                                    "new_display",
                                                                    [ Ty.path "u64" ]
                                                                  |),
                                                                  [ x ]
                                                                |);
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path
                                                                      "core::fmt::rt::Argument",
                                                                    "new_display",
                                                                    [ Ty.path "u64" ]
                                                                  |),
                                                                  [ max ]
                                                                |)
                                                              ]
                                                          |)
                                                        ]
                                                      |)
                                                    ]
                                                  |)
                                                |) in
                                              res
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  ]
                              |)
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "move_binary_format::file_format_common::write_u64_as_uleb128",
                    []
                  |),
                  [ M.read (| binary |); M.read (| x |) ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_write_as_uleb128 :
    M.IsFunction "move_binary_format::serializer::write_as_uleb128" write_as_uleb128.
  
  (*
  fn serialize_signature_index(binary: &mut BinaryData, idx: &SignatureIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, SIGNATURE_INDEX_MAX)
  }
  *)
  Definition serialize_signature_index (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::SignatureIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::SIGNATURE_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_signature_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_signature_index"
      serialize_signature_index.
  
  (*
  fn serialize_module_handle_index(binary: &mut BinaryData, idx: &ModuleHandleIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, MODULE_HANDLE_INDEX_MAX)
  }
  *)
  Definition serialize_module_handle_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::ModuleHandleIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::MODULE_HANDLE_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_module_handle_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_module_handle_index"
      serialize_module_handle_index.
  
  (*
  fn serialize_identifier_index(binary: &mut BinaryData, idx: &IdentifierIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, IDENTIFIER_INDEX_MAX)
  }
  *)
  Definition serialize_identifier_index (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::IdentifierIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::IDENTIFIER_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_identifier_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_identifier_index"
      serialize_identifier_index.
  
  (*
  fn serialize_struct_handle_index(binary: &mut BinaryData, idx: &StructHandleIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, STRUCT_HANDLE_INDEX_MAX)
  }
  *)
  Definition serialize_struct_handle_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::StructHandleIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::STRUCT_HANDLE_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_struct_handle_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_struct_handle_index"
      serialize_struct_handle_index.
  
  (*
  fn serialize_address_identifier_index(
      binary: &mut BinaryData,
      idx: &AddressIdentifierIndex,
  ) -> Result<()> {
      write_as_uleb128(binary, idx.0, ADDRESS_INDEX_MAX)
  }
  *)
  Definition serialize_address_identifier_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::AddressIdentifierIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::ADDRESS_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_address_identifier_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_address_identifier_index"
      serialize_address_identifier_index.
  
  (*
  fn serialize_struct_def_index(binary: &mut BinaryData, idx: &StructDefinitionIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, STRUCT_DEF_INDEX_MAX)
  }
  *)
  Definition serialize_struct_def_index (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::StructDefinitionIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::STRUCT_DEF_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_struct_def_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_struct_def_index"
      serialize_struct_def_index.
  
  (*
  fn serialize_function_handle_index(
      binary: &mut BinaryData,
      idx: &FunctionHandleIndex,
  ) -> Result<()> {
      write_as_uleb128(binary, idx.0, FUNCTION_HANDLE_INDEX_MAX)
  }
  *)
  Definition serialize_function_handle_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::FunctionHandleIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (|
                "move_binary_format::file_format_common::FUNCTION_HANDLE_INDEX_MAX"
              |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_function_handle_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_function_handle_index"
      serialize_function_handle_index.
  
  (*
  fn serialize_field_handle_index(binary: &mut BinaryData, idx: &FieldHandleIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, FIELD_HANDLE_INDEX_MAX)
  }
  *)
  Definition serialize_field_handle_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::FieldHandleIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::FIELD_HANDLE_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_handle_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_field_handle_index"
      serialize_field_handle_index.
  
  (*
  fn serialize_field_inst_index(
      binary: &mut BinaryData,
      idx: &FieldInstantiationIndex,
  ) -> Result<()> {
      write_as_uleb128(binary, idx.0, FIELD_INST_INDEX_MAX)
  }
  *)
  Definition serialize_field_inst_index (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::FieldInstantiationIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::FIELD_INST_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_inst_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_field_inst_index"
      serialize_field_inst_index.
  
  (*
  fn serialize_function_inst_index(
      binary: &mut BinaryData,
      idx: &FunctionInstantiationIndex,
  ) -> Result<()> {
      write_as_uleb128(binary, idx.0, FUNCTION_INST_INDEX_MAX)
  }
  *)
  Definition serialize_function_inst_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::FunctionInstantiationIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::FUNCTION_INST_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_function_inst_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_function_inst_index"
      serialize_function_inst_index.
  
  (*
  fn serialize_struct_def_inst_index(
      binary: &mut BinaryData,
      idx: &StructDefInstantiationIndex,
  ) -> Result<()> {
      write_as_uleb128(binary, idx.0, STRUCT_DEF_INST_INDEX_MAX)
  }
  *)
  Definition serialize_struct_def_inst_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::StructDefInstantiationIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (|
                "move_binary_format::file_format_common::STRUCT_DEF_INST_INDEX_MAX"
              |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_struct_def_inst_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_struct_def_inst_index"
      serialize_struct_def_inst_index.
  
  (*
  fn seiralize_table_offset(binary: &mut BinaryData, offset: u32) -> Result<()> {
      write_as_uleb128(binary, offset, TABLE_OFFSET_MAX)
  }
  *)
  Definition seiralize_table_offset (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; offset ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let offset := M.alloc (| offset |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u32"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| offset |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::TABLE_OFFSET_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_seiralize_table_offset :
    M.IsFunction "move_binary_format::serializer::seiralize_table_offset" seiralize_table_offset.
  
  (*
  fn serialize_table_size(binary: &mut BinaryData, size: u32) -> Result<()> {
      write_as_uleb128(binary, size, TABLE_SIZE_MAX)
  }
  *)
  Definition serialize_table_size (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; size ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let size := M.alloc (| size |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u32"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| size |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::TABLE_SIZE_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_table_size :
    M.IsFunction "move_binary_format::serializer::serialize_table_size" serialize_table_size.
  
  (*
  fn serialize_constant_pool_index(binary: &mut BinaryData, idx: &ConstantPoolIndex) -> Result<()> {
      write_as_uleb128(binary, idx.0, CONSTANT_INDEX_MAX)
  }
  *)
  Definition serialize_constant_pool_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (|
              M.SubPointer.get_struct_tuple_field (|
                M.read (| idx |),
                "move_binary_format::file_format::ConstantPoolIndex",
                0
              |)
            |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::CONSTANT_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_constant_pool_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_constant_pool_index"
      serialize_constant_pool_index.
  
  (*
  fn serialize_bytecode_count(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, BYTECODE_COUNT_MAX)
  }
  *)
  Definition serialize_bytecode_count (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::BYTECODE_COUNT_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_bytecode_count :
    M.IsFunction
      "move_binary_format::serializer::serialize_bytecode_count"
      serialize_bytecode_count.
  
  (*
  fn serialize_identifier_size(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, IDENTIFIER_SIZE_MAX)
  }
  *)
  Definition serialize_identifier_size (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::IDENTIFIER_SIZE_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_identifier_size :
    M.IsFunction
      "move_binary_format::serializer::serialize_identifier_size"
      serialize_identifier_size.
  
  (*
  fn serialize_constant_size(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, CONSTANT_SIZE_MAX)
  }
  *)
  Definition serialize_constant_size (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::CONSTANT_SIZE_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_constant_size :
    M.IsFunction "move_binary_format::serializer::serialize_constant_size" serialize_constant_size.
  
  (*
  fn serialize_metadata_key_size(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, METADATA_KEY_SIZE_MAX)
  }
  *)
  Definition serialize_metadata_key_size
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::METADATA_KEY_SIZE_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_metadata_key_size :
    M.IsFunction
      "move_binary_format::serializer::serialize_metadata_key_size"
      serialize_metadata_key_size.
  
  (*
  fn serialize_metadata_value_size(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, METADATA_VALUE_SIZE_MAX)
  }
  *)
  Definition serialize_metadata_value_size
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::METADATA_VALUE_SIZE_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_metadata_value_size :
    M.IsFunction
      "move_binary_format::serializer::serialize_metadata_value_size"
      serialize_metadata_value_size.
  
  (*
  fn serialize_field_count(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, FIELD_COUNT_MAX)
  }
  *)
  Definition serialize_field_count (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::FIELD_COUNT_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_count :
    M.IsFunction "move_binary_format::serializer::serialize_field_count" serialize_field_count.
  
  (*
  fn serialize_field_offset(binary: &mut BinaryData, offset: u16) -> Result<()> {
      write_as_uleb128(binary, offset, FIELD_OFFSET_MAX)
  }
  *)
  Definition serialize_field_offset (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; offset ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let offset := M.alloc (| offset |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| offset |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::FIELD_OFFSET_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_offset :
    M.IsFunction "move_binary_format::serializer::serialize_field_offset" serialize_field_offset.
  
  (*
  fn serialize_acquires_count(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, ACQUIRES_COUNT_MAX)
  }
  *)
  Definition serialize_acquires_count (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::ACQUIRES_COUNT_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_acquires_count :
    M.IsFunction
      "move_binary_format::serializer::serialize_acquires_count"
      serialize_acquires_count.
  
  (*
  fn serialize_signature_size(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, SIGNATURE_SIZE_MAX)
  }
  *)
  Definition serialize_signature_size (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::SIGNATURE_SIZE_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_signature_size :
    M.IsFunction
      "move_binary_format::serializer::serialize_signature_size"
      serialize_signature_size.
  
  (*
  fn serialize_type_parameter_index(binary: &mut BinaryData, idx: u16) -> Result<()> {
      write_as_uleb128(binary, idx, TYPE_PARAMETER_INDEX_MAX)
  }
  *)
  Definition serialize_type_parameter_index
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| idx |);
            M.read (|
              M.get_constant (|
                "move_binary_format::file_format_common::TYPE_PARAMETER_INDEX_MAX"
              |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_type_parameter_index :
    M.IsFunction
      "move_binary_format::serializer::serialize_type_parameter_index"
      serialize_type_parameter_index.
  
  (*
  fn serialize_type_parameter_count(binary: &mut BinaryData, len: usize) -> Result<()> {
      write_as_uleb128(binary, len as u64, TYPE_PARAMETER_COUNT_MAX)
  }
  *)
  Definition serialize_type_parameter_count
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u64"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.rust_cast (M.read (| len |));
            M.read (|
              M.get_constant (|
                "move_binary_format::file_format_common::TYPE_PARAMETER_COUNT_MAX"
              |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_type_parameter_count :
    M.IsFunction
      "move_binary_format::serializer::serialize_type_parameter_count"
      serialize_type_parameter_count.
  
  (*
  fn serialize_bytecode_offset(binary: &mut BinaryData, offset: u16) -> Result<()> {
      write_as_uleb128(binary, offset, BYTECODE_INDEX_MAX)
  }
  *)
  Definition serialize_bytecode_offset (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; offset ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let offset := M.alloc (| offset |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u16"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| offset |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::BYTECODE_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_bytecode_offset :
    M.IsFunction
      "move_binary_format::serializer::serialize_bytecode_offset"
      serialize_bytecode_offset.
  
  (*
  fn serialize_table_count(binary: &mut BinaryData, len: u8) -> Result<()> {
      write_as_uleb128(binary, len, TABLE_COUNT_MAX)
  }
  *)
  Definition serialize_table_count (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; len ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let len := M.alloc (| len |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u8"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| len |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::TABLE_COUNT_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_table_count :
    M.IsFunction "move_binary_format::serializer::serialize_table_count" serialize_table_count.
  
  (*
  fn serialize_local_index(binary: &mut BinaryData, idx: u8) -> Result<()> {
      write_as_uleb128(binary, idx, LOCAL_INDEX_MAX)
  }
  *)
  Definition serialize_local_index (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; idx ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let idx := M.alloc (| idx |) in
        M.call_closure (|
          M.get_function (|
            "move_binary_format::serializer::write_as_uleb128",
            [ Ty.path "u8"; Ty.path "u64" ]
          |),
          [
            M.read (| binary |);
            M.read (| idx |);
            M.read (|
              M.get_constant (| "move_binary_format::file_format_common::LOCAL_INDEX_MAX" |)
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_local_index :
    M.IsFunction "move_binary_format::serializer::serialize_local_index" serialize_local_index.
  
  (*
  fn validate_version(version: u32) -> Result<()> {
      if !(VERSION_MIN..=VERSION_MAX).contains(&version) {
          bail!(
              "The requested bytecode version {} is not supported. Only {} to {} are.",
              version,
              VERSION_MIN,
              VERSION_MAX
          )
      } else {
          Ok(())
      }
  }
  *)
  Definition validate_version (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ version ] =>
      ltac:(M.monadic
        (let version := M.alloc (| version |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::ops::range::RangeInclusive")
                                    []
                                    [ Ty.path "u32" ],
                                  "contains",
                                  [ Ty.path "u32" ]
                                |),
                                [
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::ops::range::RangeInclusive")
                                          []
                                          [ Ty.path "u32" ],
                                        "new",
                                        []
                                      |),
                                      [
                                        M.read (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::VERSION_MIN"
                                          |)
                                        |);
                                        M.read (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::VERSION_MAX"
                                          |)
                                        |)
                                      ]
                                    |)
                                  |);
                                  version
                                ]
                              |)
                            |)
                          |)) 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 "anyhow::Error",
                                      "msg",
                                      [ Ty.path "alloc::string::String" ]
                                    |),
                                    [
                                      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
                                                                  "The requested bytecode version "
                                                              |);
                                                              M.read (|
                                                                Value.String
                                                                  " is not supported. Only "
                                                              |);
                                                              M.read (| Value.String " to " |);
                                                              M.read (| Value.String " are." |)
                                                            ]
                                                        |);
                                                        M.alloc (|
                                                          Value.Array
                                                            [
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path "core::fmt::rt::Argument",
                                                                  "new_display",
                                                                  [ Ty.path "u32" ]
                                                                |),
                                                                [ version ]
                                                              |);
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path "core::fmt::rt::Argument",
                                                                  "new_display",
                                                                  [ Ty.path "u32" ]
                                                                |),
                                                                [
                                                                  M.get_constant (|
                                                                    "move_binary_format::file_format_common::VERSION_MIN"
                                                                  |)
                                                                ]
                                                              |);
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path "core::fmt::rt::Argument",
                                                                  "new_display",
                                                                  [ Ty.path "u32" ]
                                                                |),
                                                                [
                                                                  M.get_constant (|
                                                                    "move_binary_format::file_format_common::VERSION_MAX"
                                                                  |)
                                                                ]
                                                              |)
                                                            ]
                                                        |)
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              |) in
                                            res
                                          |)
                                        ]
                                      |)
                                    ]
                                  |)
                                ]
                            |)
                          |)
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (M.alloc (|
                        Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]
                      |)))
                ]
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_validate_version :
    M.IsFunction "move_binary_format::serializer::validate_version" validate_version.
  
  Module Impl_move_binary_format_file_format_CompiledModule.
    Definition Self : Ty.t := Ty.path "move_binary_format::file_format::CompiledModule".
    
    (*
        pub fn serialize(&self, binary: &mut Vec<u8>) -> Result<()> {
            self.serialize_for_version(None, binary)
        }
    *)
    Definition serialize (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.path "move_binary_format::file_format::CompiledModule",
              "serialize_for_version",
              []
            |),
            [
              M.read (| self |);
              Value.StructTuple "core::option::Option::None" [];
              M.read (| binary |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize : M.IsAssociatedFunction Self "serialize" serialize.
    
    (*
        pub fn serialize_for_version(
            &self,
            bytecode_version: Option<u32>,
            binary: &mut Vec<u8>,
        ) -> Result<()> {
            let version = bytecode_version.unwrap_or(VERSION_MAX);
            validate_version(version)?;
            let mut binary_data = BinaryData::from(binary.clone());
            let mut ser = ModuleSerializer::new(version);
            let mut temp = BinaryData::new();
            ser.serialize_tables(&mut temp, self)?;
            if temp.len() > u32::max_value() as usize {
                bail!(
                    "table content size ({}) cannot exceed ({})",
                    temp.len(),
                    u32::max_value()
                );
            }
            ser.common.serialize_header(&mut binary_data)?;
            ser.serialize_table_indices(&mut binary_data)?;
    
            binary_data.extend(temp.as_inner())?;
    
            serialize_module_handle_index(&mut binary_data, &self.self_module_handle_idx)?;
    
            *binary = binary_data.into_inner();
            Ok(())
        }
    *)
    Definition serialize_for_version (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; bytecode_version; binary ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let bytecode_version := M.alloc (| bytecode_version |) in
          let binary := M.alloc (| binary |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ version :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "core::option::Option") [] [ Ty.path "u32" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.read (| bytecode_version |);
                        M.read (|
                          M.get_constant (| "move_binary_format::file_format_common::VERSION_MAX" |)
                        |)
                      ]
                    |)
                  |) 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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::validate_version",
                              []
                            |),
                            [ M.read (| version |) ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ binary_data :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::convert::From",
                        Ty.path "move_binary_format::file_format_common::BinaryData",
                        [
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]
                        ],
                        "from",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::clone::Clone",
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            [],
                            "clone",
                            []
                          |),
                          [ M.read (| binary |) ]
                        |)
                      ]
                    |)
                  |) in
                let~ ser :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "move_binary_format::serializer::ModuleSerializer",
                        "new",
                        []
                      |),
                      [ M.read (| version |) ]
                    |)
                  |) in
                let~ temp :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "move_binary_format::file_format_common::BinaryData",
                        "new",
                        []
                      |),
                      []
                    |)
                  |) 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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_tables",
                              []
                            |),
                            [ ser; temp; M.read (| self |) ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Break",
                              0
                            |) in
                          let residual := M.copy (| γ0_0 |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.read (|
                                M.return_ (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::try_trait::FromResidual",
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [ Ty.tuple []; Ty.path "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.gt (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "len",
                                      []
                                    |),
                                    [ temp ]
                                  |),
                                  M.rust_cast
                                    (M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "u32",
                                        "max_value",
                                        []
                                      |),
                                      []
                                    |))
                                |)
                              |)) 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 "anyhow::Error",
                                          "msg",
                                          [ Ty.path "alloc::string::String" ]
                                        |),
                                        [
                                          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
                                                                      "table content size ("
                                                                  |);
                                                                  M.read (|
                                                                    Value.String ") cannot exceed ("
                                                                  |);
                                                                  M.read (| Value.String ")" |)
                                                                ]
                                                            |);
                                                            M.alloc (|
                                                              Value.Array
                                                                [
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.path
                                                                        "core::fmt::rt::Argument",
                                                                      "new_display",
                                                                      [ Ty.path "usize" ]
                                                                    |),
                                                                    [
                                                                      M.alloc (|
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.path
                                                                              "move_binary_format::file_format_common::BinaryData",
                                                                            "len",
                                                                            []
                                                                          |),
                                                                          [ temp ]
                                                                        |)
                                                                      |)
                                                                    ]
                                                                  |);
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.path
                                                                        "core::fmt::rt::Argument",
                                                                      "new_display",
                                                                      [ Ty.path "u32" ]
                                                                    |),
                                                                    [
                                                                      M.alloc (|
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.path "u32",
                                                                            "max_value",
                                                                            []
                                                                          |),
                                                                          []
                                                                        |)
                                                                      |)
                                                                    ]
                                                                  |)
                                                                ]
                                                            |)
                                                          ]
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                res
                                              |)
                                            ]
                                          |)
                                        ]
                                      |)
                                    ]
                                |)
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) 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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_header",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                ser,
                                "move_binary_format::serializer::ModuleSerializer",
                                "common"
                              |);
                              binary_data
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_table_indices",
                              []
                            |),
                            [ ser; binary_data ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::file_format_common::BinaryData",
                              "extend",
                              []
                            |),
                            [
                              binary_data;
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "move_binary_format::file_format_common::BinaryData",
                                  "as_inner",
                                  []
                                |),
                                [ temp ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_module_handle_index",
                              []
                            |),
                            [
                              binary_data;
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::file_format::CompiledModule",
                                "self_module_handle_idx"
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.write (|
                    M.read (| binary |),
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "move_binary_format::file_format_common::BinaryData",
                        "into_inner",
                        []
                      |),
                      [ M.read (| binary_data |) ]
                    |)
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_for_version :
      M.IsAssociatedFunction Self "serialize_for_version" serialize_for_version.
  End Impl_move_binary_format_file_format_CompiledModule.
  
  (* StructRecord
    {
      name := "CommonSerializer";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("major_version", Ty.path "u32");
          ("table_count", Ty.path "u8");
          ("module_handles", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("struct_handles", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("function_handles", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("function_instantiations", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("signatures", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("identifiers", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("address_identifiers", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("constant_pool", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("metadata", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ])
        ];
    } *)
  
  Module Impl_core_fmt_Debug_for_move_binary_format_serializer_CommonSerializer.
    Definition Self : Ty.t := Ty.path "move_binary_format::serializer::CommonSerializer".
    
    (* Debug *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.read (|
            let~ names :=
              M.alloc (|
                M.alloc (|
                  Value.Array
                    [
                      M.read (| Value.String "major_version" |);
                      M.read (| Value.String "table_count" |);
                      M.read (| Value.String "module_handles" |);
                      M.read (| Value.String "struct_handles" |);
                      M.read (| Value.String "function_handles" |);
                      M.read (| Value.String "function_instantiations" |);
                      M.read (| Value.String "signatures" |);
                      M.read (| Value.String "identifiers" |);
                      M.read (| Value.String "address_identifiers" |);
                      M.read (| Value.String "constant_pool" |);
                      M.read (| Value.String "metadata" |)
                    ]
                |)
              |) in
            let~ values :=
              M.alloc (|
                M.alloc (|
                  Value.Array
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "major_version"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "table_count"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "module_handles"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "struct_handles"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "function_handles"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "function_instantiations"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "signatures"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "identifiers"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "address_identifiers"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::CommonSerializer",
                        "constant_pool"
                      |);
                      M.alloc (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "move_binary_format::serializer::CommonSerializer",
                          "metadata"
                        |)
                      |)
                    ]
                |)
              |) in
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "core::fmt::Formatter",
                  "debug_struct_fields_finish",
                  []
                |),
                [
                  M.read (| f |);
                  M.read (| Value.String "CommonSerializer" |);
                  M.read (| names |);
                  M.read (| values |)
                ]
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_move_binary_format_serializer_CommonSerializer.
  
  (* StructRecord
    {
      name := "ModuleSerializer";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("common", Ty.path "move_binary_format::serializer::CommonSerializer");
          ("struct_defs", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("struct_def_instantiations", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("function_defs", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("field_handles", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("field_instantiations", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ]);
          ("friend_decls", Ty.tuple [ Ty.path "u32"; Ty.path "u32" ])
        ];
    } *)
  
  Module Impl_core_fmt_Debug_for_move_binary_format_serializer_ModuleSerializer.
    Definition Self : Ty.t := Ty.path "move_binary_format::serializer::ModuleSerializer".
    
    (* Debug *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.read (|
            let~ names :=
              M.alloc (|
                M.alloc (|
                  Value.Array
                    [
                      M.read (| Value.String "common" |);
                      M.read (| Value.String "struct_defs" |);
                      M.read (| Value.String "struct_def_instantiations" |);
                      M.read (| Value.String "function_defs" |);
                      M.read (| Value.String "field_handles" |);
                      M.read (| Value.String "field_instantiations" |);
                      M.read (| Value.String "friend_decls" |)
                    ]
                |)
              |) in
            let~ values :=
              M.alloc (|
                M.alloc (|
                  Value.Array
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::ModuleSerializer",
                        "common"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::ModuleSerializer",
                        "struct_defs"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::ModuleSerializer",
                        "struct_def_instantiations"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::ModuleSerializer",
                        "function_defs"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::ModuleSerializer",
                        "field_handles"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_binary_format::serializer::ModuleSerializer",
                        "field_instantiations"
                      |);
                      M.alloc (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "move_binary_format::serializer::ModuleSerializer",
                          "friend_decls"
                        |)
                      |)
                    ]
                |)
              |) in
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "core::fmt::Formatter",
                  "debug_struct_fields_finish",
                  []
                |),
                [
                  M.read (| f |);
                  M.read (| Value.String "ModuleSerializer" |);
                  M.read (| names |);
                  M.read (| values |)
                ]
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_move_binary_format_serializer_ModuleSerializer.
  
  (*
  fn check_index_in_binary(index: usize) -> Result<u32> {
      if index > u32::max_value() as usize {
          bail!(
              "Compilation unit too big ({}) cannot exceed {}",
              index,
              u32::max_value()
          )
      }
      Ok(index as u32)
  }
  *)
  Definition check_index_in_binary (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ index ] =>
      ltac:(M.monadic
        (let index := M.alloc (| index |) 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.gt (|
                                M.read (| index |),
                                M.rust_cast
                                  (M.call_closure (|
                                    M.get_associated_function (| Ty.path "u32", "max_value", [] |),
                                    []
                                  |))
                              |)
                            |)) 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 "anyhow::Error",
                                        "msg",
                                        [ Ty.path "alloc::string::String" ]
                                      |),
                                      [
                                        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
                                                                    "Compilation unit too big ("
                                                                |);
                                                                M.read (|
                                                                  Value.String ") cannot exceed "
                                                                |)
                                                              ]
                                                          |);
                                                          M.alloc (|
                                                            Value.Array
                                                              [
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path
                                                                      "core::fmt::rt::Argument",
                                                                    "new_display",
                                                                    [ Ty.path "usize" ]
                                                                  |),
                                                                  [ index ]
                                                                |);
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path
                                                                      "core::fmt::rt::Argument",
                                                                    "new_display",
                                                                    [ Ty.path "u32" ]
                                                                  |),
                                                                  [
                                                                    M.alloc (|
                                                                      M.call_closure (|
                                                                        M.get_associated_function (|
                                                                          Ty.path "u32",
                                                                          "max_value",
                                                                          []
                                                                        |),
                                                                        []
                                                                      |)
                                                                    |)
                                                                  ]
                                                                |)
                                                              ]
                                                          |)
                                                        ]
                                                      |)
                                                    ]
                                                  |)
                                                |) in
                                              res
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  ]
                              |)
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              M.alloc (|
                Value.StructTuple "core::result::Result::Ok" [ M.rust_cast (M.read (| index |)) ]
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_check_index_in_binary :
    M.IsFunction "move_binary_format::serializer::check_index_in_binary" check_index_in_binary.
  
  (*
  fn serialize_table_index(
      binary: &mut BinaryData,
      kind: TableType,
      offset: u32,
      count: u32,
  ) -> Result<()> {
      if count != 0 {
          binary.push(kind as u8)?;
          seiralize_table_offset(binary, offset)?;
          serialize_table_size(binary, count)?;
      }
      Ok(())
  }
  *)
  Definition serialize_table_index (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; kind; offset; count ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let kind := M.alloc (| kind |) in
        let offset := M.alloc (| offset |) in
        let count := M.alloc (| count |) 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.read (| count |), Value.Integer IntegerKind.U32 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) 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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "push",
                                      []
                                    |),
                                    [ M.read (| binary |); M.rust_cast (M.read (| kind |)) ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        let~ _ :=
                          M.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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "move_binary_format::serializer::seiralize_table_offset",
                                      []
                                    |),
                                    [ M.read (| binary |); M.read (| offset |) ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        let~ _ :=
                          M.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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "move_binary_format::serializer::serialize_table_size",
                                      []
                                    |),
                                    [ M.read (| binary |); M.read (| count |) ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_table_index :
    M.IsFunction "move_binary_format::serializer::serialize_table_index" serialize_table_index.
  
  (*
  fn serialize_magic(binary: &mut BinaryData) -> Result<()> {
      for byte in &BinaryConstants::MOVE_MAGIC {
          binary.push( *byte)?;
      }
      Ok(())
  }
  *)
  Definition serialize_magic (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) 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 "&")
                            []
                            [
                              Ty.apply
                                (Ty.path "array")
                                [ Value.Integer IntegerKind.Usize 4 ]
                                [ Ty.path "u8" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.get_constant (| "move_binary_format::file_format_common::MOVE_MAGIC" |)
                        ]
                      |)
                    |),
                    [
                      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 "u8" ],
                                        [],
                                        "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 byte := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path
                                                        "move_binary_format::file_format_common::BinaryData",
                                                      "push",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| binary |);
                                                      M.read (| M.read (| byte |) |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_magic :
    M.IsFunction "move_binary_format::serializer::serialize_magic" serialize_magic.
  
  (* Trait *)
  (* Empty module 'CommonTables' *)
  
  Module Impl_move_binary_format_serializer_CommonTables_for_move_binary_format_file_format_CompiledModule.
    Definition Self : Ty.t := Ty.path "move_binary_format::file_format::CompiledModule".
    
    (*
        fn get_module_handles(&self) -> &[ModuleHandle] {
            &self.module_handles
        }
    *)
    Definition get_module_handles (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_binary_format::file_format::ModuleHandle";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "module_handles"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_struct_handles(&self) -> &[StructHandle] {
            &self.struct_handles
        }
    *)
    Definition get_struct_handles (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_binary_format::file_format::StructHandle";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "struct_handles"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_function_handles(&self) -> &[FunctionHandle] {
            &self.function_handles
        }
    *)
    Definition get_function_handles (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_binary_format::file_format::FunctionHandle";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "function_handles"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_function_instantiations(&self) -> &[FunctionInstantiation] {
            &self.function_instantiations
        }
    *)
    Definition get_function_instantiations
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_binary_format::file_format::FunctionInstantiation";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "function_instantiations"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_identifiers(&self) -> &[Identifier] {
            &self.identifiers
        }
    *)
    Definition get_identifiers (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "move_core_types::identifier::Identifier"; Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "identifiers"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_address_identifiers(&self) -> &[AccountAddress] {
            &self.address_identifiers
        }
    *)
    Definition get_address_identifiers (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_core_types::account_address::AccountAddress";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "address_identifiers"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_constant_pool(&self) -> &[Constant] {
            &self.constant_pool
        }
    *)
    Definition get_constant_pool (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_binary_format::file_format::Constant";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "constant_pool"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_signatures(&self) -> &[Signature] {
            &self.signatures
        }
    *)
    Definition get_signatures (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [
                  Ty.path "move_binary_format::file_format::Signature";
                  Ty.path "alloc::alloc::Global"
                ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "signatures"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn get_metadata(&self) -> &[Metadata] {
            &self.metadata
        }
    *)
    Definition get_metadata (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "move_core_types::metadata::Metadata"; Ty.path "alloc::alloc::Global" ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_binary_format::file_format::CompiledModule",
                "metadata"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "move_binary_format::serializer::CommonTables"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("get_module_handles", InstanceField.Method get_module_handles);
          ("get_struct_handles", InstanceField.Method get_struct_handles);
          ("get_function_handles", InstanceField.Method get_function_handles);
          ("get_function_instantiations", InstanceField.Method get_function_instantiations);
          ("get_identifiers", InstanceField.Method get_identifiers);
          ("get_address_identifiers", InstanceField.Method get_address_identifiers);
          ("get_constant_pool", InstanceField.Method get_constant_pool);
          ("get_signatures", InstanceField.Method get_signatures);
          ("get_metadata", InstanceField.Method get_metadata)
        ].
  End Impl_move_binary_format_serializer_CommonTables_for_move_binary_format_file_format_CompiledModule.
  
  (*
  fn serialize_module_handle(binary: &mut BinaryData, module_handle: &ModuleHandle) -> Result<()> {
      serialize_address_identifier_index(binary, &module_handle.address)?;
      serialize_identifier_index(binary, &module_handle.name)?;
      Ok(())
  }
  *)
  Definition serialize_module_handle (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; module_handle ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let module_handle := M.alloc (| module_handle |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_address_identifier_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| module_handle |),
                              "move_binary_format::file_format::ModuleHandle",
                              "address"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_identifier_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| module_handle |),
                              "move_binary_format::file_format::ModuleHandle",
                              "name"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_module_handle :
    M.IsFunction "move_binary_format::serializer::serialize_module_handle" serialize_module_handle.
  
  (*
  fn serialize_struct_handle(binary: &mut BinaryData, struct_handle: &StructHandle) -> Result<()> {
      serialize_module_handle_index(binary, &struct_handle.module)?;
      serialize_identifier_index(binary, &struct_handle.name)?;
      serialize_ability_set(binary, struct_handle.abilities)?;
      serialize_type_parameters(binary, &struct_handle.type_parameters)
  }
  *)
  Definition serialize_struct_handle (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; struct_handle ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let struct_handle := M.alloc (| struct_handle |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_module_handle_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| struct_handle |),
                              "move_binary_format::file_format::StructHandle",
                              "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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_identifier_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| struct_handle |),
                              "move_binary_format::file_format::StructHandle",
                              "name"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_ability_set",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.read (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| struct_handle |),
                                "move_binary_format::file_format::StructHandle",
                                "abilities"
                              |)
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "move_binary_format::serializer::serialize_type_parameters",
                    []
                  |),
                  [
                    M.read (| binary |);
                    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.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_struct_handle :
    M.IsFunction "move_binary_format::serializer::serialize_struct_handle" serialize_struct_handle.
  
  (*
  fn serialize_type_parameters(
      binary: &mut BinaryData,
      type_parameters: &[StructTypeParameter],
  ) -> Result<()> {
      serialize_type_parameter_count(binary, type_parameters.len())?;
      for type_param in type_parameters {
          serialize_type_parameter(binary, type_param)?;
      }
      Ok(())
  }
  *)
  Definition serialize_type_parameters (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; type_parameters ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let type_parameters := M.alloc (| type_parameters |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_type_parameter_count",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::StructTypeParameter"
                                  ],
                                "len",
                                []
                              |),
                              [ M.read (| type_parameters |) ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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::StructTypeParameter" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| type_parameters |) ]
                      |)
                    |),
                    [
                      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::StructTypeParameter"
                                          ],
                                        [],
                                        "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 type_param := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_type_parameter",
                                                      []
                                                    |),
                                                    [ M.read (| binary |); M.read (| type_param |) ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_type_parameters :
    M.IsFunction
      "move_binary_format::serializer::serialize_type_parameters"
      serialize_type_parameters.
  
  (*
  fn serialize_type_parameter(
      binary: &mut BinaryData,
      type_param: &StructTypeParameter,
  ) -> Result<()> {
      serialize_ability_set(binary, type_param.constraints)?;
      write_as_uleb128(binary, type_param.is_phantom as u8, 1u64)
  }
  *)
  Definition serialize_type_parameter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; type_param ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let type_param := M.alloc (| type_param |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_ability_set",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.read (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| type_param |),
                                "move_binary_format::file_format::StructTypeParameter",
                                "constraints"
                              |)
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "move_binary_format::serializer::write_as_uleb128",
                    [ Ty.path "u8"; Ty.path "u64" ]
                  |),
                  [
                    M.read (| binary |);
                    M.rust_cast
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| type_param |),
                          "move_binary_format::file_format::StructTypeParameter",
                          "is_phantom"
                        |)
                      |));
                    Value.Integer IntegerKind.U64 1
                  ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_type_parameter :
    M.IsFunction
      "move_binary_format::serializer::serialize_type_parameter"
      serialize_type_parameter.
  
  (*
  fn serialize_function_handle(
      binary: &mut BinaryData,
      function_handle: &FunctionHandle,
  ) -> Result<()> {
      serialize_module_handle_index(binary, &function_handle.module)?;
      serialize_identifier_index(binary, &function_handle.name)?;
      serialize_signature_index(binary, &function_handle.parameters)?;
      serialize_signature_index(binary, &function_handle.return_)?;
      serialize_ability_sets(binary, &function_handle.type_parameters)
  }
  *)
  Definition serialize_function_handle (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; function_handle ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let function_handle := M.alloc (| function_handle |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_module_handle_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| function_handle |),
                              "move_binary_format::file_format::FunctionHandle",
                              "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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_identifier_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| function_handle |),
                              "move_binary_format::file_format::FunctionHandle",
                              "name"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| function_handle |),
                              "move_binary_format::file_format::FunctionHandle",
                              "parameters"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| function_handle |),
                              "move_binary_format::file_format::FunctionHandle",
                              "return_"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "move_binary_format::serializer::serialize_ability_sets", [] |),
                  [
                    M.read (| binary |);
                    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.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_function_handle :
    M.IsFunction
      "move_binary_format::serializer::serialize_function_handle"
      serialize_function_handle.
  
  (*
  fn serialize_function_instantiation(
      binary: &mut BinaryData,
      func_inst: &FunctionInstantiation,
  ) -> Result<()> {
      serialize_function_handle_index(binary, &func_inst.handle)?;
      serialize_signature_index(binary, &func_inst.type_parameters)?;
      Ok(())
  }
  *)
  Definition serialize_function_instantiation
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; func_inst ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let func_inst := M.alloc (| func_inst |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_function_handle_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| func_inst |),
                              "move_binary_format::file_format::FunctionInstantiation",
                              "handle"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| func_inst |),
                              "move_binary_format::file_format::FunctionInstantiation",
                              "type_parameters"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_function_instantiation :
    M.IsFunction
      "move_binary_format::serializer::serialize_function_instantiation"
      serialize_function_instantiation.
  
  (*
  fn serialize_identifier(binary: &mut BinaryData, string: &str) -> Result<()> {
      let bytes = string.as_bytes();
      serialize_identifier_size(binary, bytes.len())?;
      for byte in bytes {
          binary.push( *byte)?;
      }
      Ok(())
  }
  *)
  Definition serialize_identifier (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; string ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let string := M.alloc (| string |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (| Ty.path "str", "as_bytes", [] |),
                    [ M.read (| string |) ]
                  |)
                |) 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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_identifier_size",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                "len",
                                []
                              |),
                              [ M.read (| bytes |) ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Break",
                            0
                          |) in
                        let residual := M.copy (| γ0_0 |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.read (|
                              M.return_ (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::try_trait::FromResidual",
                                    Ty.apply
                                      (Ty.path "core::result::Result")
                                      []
                                      [ Ty.tuple []; Ty.path "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "u8" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| bytes |) ]
                      |)
                    |),
                    [
                      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 "u8" ],
                                        [],
                                        "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 byte := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path
                                                        "move_binary_format::file_format_common::BinaryData",
                                                      "push",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| binary |);
                                                      M.read (| M.read (| byte |) |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_identifier :
    M.IsFunction "move_binary_format::serializer::serialize_identifier" serialize_identifier.
  
  (*
  fn serialize_address(binary: &mut BinaryData, address: &AccountAddress) -> Result<()> {
      for byte in address.as_ref() {
          binary.push( *byte)?;
      }
      Ok(())
  }
  *)
  Definition serialize_address (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; address ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let address := M.alloc (| address |) 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 "&")
                            []
                            [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::convert::AsRef",
                              Ty.path "move_core_types::account_address::AccountAddress",
                              [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                              "as_ref",
                              []
                            |),
                            [ M.read (| address |) ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "u8" ],
                                        [],
                                        "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 byte := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path
                                                        "move_binary_format::file_format_common::BinaryData",
                                                      "push",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| binary |);
                                                      M.read (| M.read (| byte |) |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_address :
    M.IsFunction "move_binary_format::serializer::serialize_address" serialize_address.
  
  (*
  fn serialize_constant(binary: &mut BinaryData, constant: &Constant) -> Result<()> {
      serialize_signature_token(binary, &constant.type_)?;
      serialize_byte_blob(binary, serialize_constant_size, &constant.data)
  }
  *)
  Definition serialize_constant (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; constant ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let constant := M.alloc (| constant |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_token",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| constant |),
                              "move_binary_format::file_format::Constant",
                              "type_"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "move_binary_format::serializer::serialize_byte_blob",
                    [
                      Ty.function
                        [
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.path "move_binary_format::file_format_common::BinaryData" ];
                          Ty.path "usize"
                        ]
                        (Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.tuple []; Ty.path "anyhow::Error" ])
                    ]
                  |),
                  [
                    M.read (| binary |);
                    M.get_function (|
                      "move_binary_format::serializer::serialize_constant_size",
                      []
                    |);
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::deref::Deref",
                        Ty.apply
                          (Ty.path "alloc::vec::Vec")
                          []
                          [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                        [],
                        "deref",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| constant |),
                          "move_binary_format::file_format::Constant",
                          "data"
                        |)
                      ]
                    |)
                  ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_constant :
    M.IsFunction "move_binary_format::serializer::serialize_constant" serialize_constant.
  
  (*
  fn serialize_metadata_entry(binary: &mut BinaryData, metadata: &Metadata) -> Result<()> {
      serialize_byte_blob(binary, serialize_metadata_key_size, &metadata.key)?;
      serialize_byte_blob(binary, serialize_metadata_value_size, &metadata.value)
  }
  *)
  Definition serialize_metadata_entry (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; metadata ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let metadata := M.alloc (| metadata |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_byte_blob",
                            [
                              Ty.function
                                [
                                  Ty.apply
                                    (Ty.path "&mut")
                                    []
                                    [ Ty.path "move_binary_format::file_format_common::BinaryData"
                                    ];
                                  Ty.path "usize"
                                ]
                                (Ty.apply
                                  (Ty.path "core::result::Result")
                                  []
                                  [ Ty.tuple []; Ty.path "anyhow::Error" ])
                            ]
                          |),
                          [
                            M.read (| binary |);
                            M.get_function (|
                              "move_binary_format::serializer::serialize_metadata_key_size",
                              []
                            |);
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::deref::Deref",
                                Ty.apply
                                  (Ty.path "alloc::vec::Vec")
                                  []
                                  [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                                [],
                                "deref",
                                []
                              |),
                              [
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| metadata |),
                                  "move_core_types::metadata::Metadata",
                                  "key"
                                |)
                              ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "move_binary_format::serializer::serialize_byte_blob",
                    [
                      Ty.function
                        [
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.path "move_binary_format::file_format_common::BinaryData" ];
                          Ty.path "usize"
                        ]
                        (Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.tuple []; Ty.path "anyhow::Error" ])
                    ]
                  |),
                  [
                    M.read (| binary |);
                    M.get_function (|
                      "move_binary_format::serializer::serialize_metadata_value_size",
                      []
                    |);
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::deref::Deref",
                        Ty.apply
                          (Ty.path "alloc::vec::Vec")
                          []
                          [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                        [],
                        "deref",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| metadata |),
                          "move_core_types::metadata::Metadata",
                          "value"
                        |)
                      ]
                    |)
                  ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_metadata_entry :
    M.IsFunction
      "move_binary_format::serializer::serialize_metadata_entry"
      serialize_metadata_entry.
  
  (*
  fn serialize_byte_blob(
      binary: &mut BinaryData,
      size_serializer: impl Fn(&mut BinaryData, usize) -> Result<()>,
      blob: &[u8],
  ) -> Result<()> {
      size_serializer(binary, blob.len())?;
      for byte in blob {
          binary.push( *byte)?;
      }
      Ok(())
  }
  *)
  Definition serialize_byte_blob (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [ impl_Fn__mut_BinaryData__usize__arrow_Result____ ], [ binary; size_serializer; blob ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let size_serializer := M.alloc (| size_serializer |) in
        let blob := M.alloc (| blob |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::function::Fn",
                            impl_Fn__mut_BinaryData__usize__arrow_Result____,
                            [
                              Ty.tuple
                                [
                                  Ty.apply
                                    (Ty.path "&mut")
                                    []
                                    [ Ty.path "move_binary_format::file_format_common::BinaryData"
                                    ];
                                  Ty.path "usize"
                                ]
                            ],
                            "call",
                            []
                          |),
                          [
                            size_serializer;
                            Value.Tuple
                              [
                                M.read (| binary |);
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| blob |) ]
                                |)
                              ]
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "u8" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| blob |) ]
                      |)
                    |),
                    [
                      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 "u8" ],
                                        [],
                                        "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 byte := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path
                                                        "move_binary_format::file_format_common::BinaryData",
                                                      "push",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| binary |);
                                                      M.read (| M.read (| byte |) |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_byte_blob :
    M.IsFunction "move_binary_format::serializer::serialize_byte_blob" serialize_byte_blob.
  
  (*
  fn serialize_struct_definition(
      binary: &mut BinaryData,
      struct_definition: &StructDefinition,
  ) -> Result<()> {
      serialize_struct_handle_index(binary, &struct_definition.struct_handle)?;
      match &struct_definition.field_information {
          StructFieldInformation::Native => binary.push(SerializedNativeStructFlag::NATIVE as u8),
          StructFieldInformation::Declared(fields) => {
              binary.push(SerializedNativeStructFlag::DECLARED as u8)?;
              serialize_field_definitions(binary, fields)
          }
      }
  }
  *)
  Definition serialize_struct_definition
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; struct_definition ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let struct_definition := M.alloc (| struct_definition |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_struct_handle_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| struct_definition |),
                              "move_binary_format::file_format::StructDefinition",
                              "struct_handle"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.match_operator (|
                M.alloc (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| struct_definition |),
                    "move_binary_format::file_format::StructDefinition",
                    "field_information"
                  |)
                |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_binary_format::file_format::StructFieldInformation::Native"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "move_binary_format::file_format_common::BinaryData",
                            "push",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.rust_cast
                              (BinOp.Wrap.add (|
                                M.get_constant (|
                                  "move_binary_format::file_format_common::SerializedNativeStructFlag::NATIVE_discriminant"
                                |),
                                Value.Integer IntegerKind.U8 0
                              |))
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "move_binary_format::file_format::StructFieldInformation::Declared",
                          0
                        |) in
                      let fields := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedNativeStructFlag::DECLARED_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_field_definitions",
                            []
                          |),
                          [
                            M.read (| binary |);
                            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::FieldDefinition";
                                    Ty.path "alloc::alloc::Global"
                                  ],
                                [],
                                "deref",
                                []
                              |),
                              [ M.read (| fields |) ]
                            |)
                          ]
                        |)
                      |)))
                ]
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_struct_definition :
    M.IsFunction
      "move_binary_format::serializer::serialize_struct_definition"
      serialize_struct_definition.
  
  (*
  fn serialize_struct_def_instantiation(
      binary: &mut BinaryData,
      struct_inst: &StructDefInstantiation,
  ) -> Result<()> {
      serialize_struct_def_index(binary, &struct_inst.def)?;
      serialize_signature_index(binary, &struct_inst.type_parameters)?;
      Ok(())
  }
  *)
  Definition serialize_struct_def_instantiation
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; struct_inst ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let struct_inst := M.alloc (| struct_inst |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_struct_def_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| struct_inst |),
                              "move_binary_format::file_format::StructDefInstantiation",
                              "def"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| struct_inst |),
                              "move_binary_format::file_format::StructDefInstantiation",
                              "type_parameters"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_struct_def_instantiation :
    M.IsFunction
      "move_binary_format::serializer::serialize_struct_def_instantiation"
      serialize_struct_def_instantiation.
  
  (*
  fn serialize_field_definitions(binary: &mut BinaryData, fields: &[FieldDefinition]) -> Result<()> {
      serialize_field_count(binary, fields.len())?;
      for field_definition in fields {
          serialize_field_definition(binary, field_definition)?;
      }
      Ok(())
  }
  *)
  Definition serialize_field_definitions
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; fields ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let fields := M.alloc (| fields |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_field_count",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::FieldDefinition" ],
                                "len",
                                []
                              |),
                              [ M.read (| fields |) ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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::FieldDefinition" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| fields |) ]
                      |)
                    |),
                    [
                      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::FieldDefinition"
                                          ],
                                        [],
                                        "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 field_definition := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_field_definition",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| binary |);
                                                      M.read (| field_definition |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_field_definitions :
    M.IsFunction
      "move_binary_format::serializer::serialize_field_definitions"
      serialize_field_definitions.
  
  (*
  fn serialize_field_definition(
      binary: &mut BinaryData,
      field_definition: &FieldDefinition,
  ) -> Result<()> {
      serialize_identifier_index(binary, &field_definition.name)?;
      serialize_signature_token(binary, &field_definition.signature.0)
  }
  *)
  Definition serialize_field_definition (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; field_definition ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let field_definition := M.alloc (| field_definition |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_identifier_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| field_definition |),
                              "move_binary_format::file_format::FieldDefinition",
                              "name"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "move_binary_format::serializer::serialize_signature_token",
                    []
                  |),
                  [
                    M.read (| binary |);
                    M.SubPointer.get_struct_tuple_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| field_definition |),
                        "move_binary_format::file_format::FieldDefinition",
                        "signature"
                      |),
                      "move_binary_format::file_format::TypeSignature",
                      0
                    |)
                  ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_definition :
    M.IsFunction
      "move_binary_format::serializer::serialize_field_definition"
      serialize_field_definition.
  
  (*
  fn serialize_field_handle(binary: &mut BinaryData, field_handle: &FieldHandle) -> Result<()> {
      serialize_struct_def_index(binary, &field_handle.owner)?;
      serialize_field_offset(binary, field_handle.field)?;
      Ok(())
  }
  *)
  Definition serialize_field_handle (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; field_handle ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let field_handle := M.alloc (| field_handle |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_struct_def_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| field_handle |),
                              "move_binary_format::file_format::FieldHandle",
                              "owner"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_field_offset",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.read (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| field_handle |),
                                "move_binary_format::file_format::FieldHandle",
                                "field"
                              |)
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_handle :
    M.IsFunction "move_binary_format::serializer::serialize_field_handle" serialize_field_handle.
  
  (*
  fn serialize_field_instantiation(
      binary: &mut BinaryData,
      field_inst: &FieldInstantiation,
  ) -> Result<()> {
      serialize_field_handle_index(binary, &field_inst.handle)?;
      serialize_signature_index(binary, &field_inst.type_parameters)?;
      Ok(())
  }
  *)
  Definition serialize_field_instantiation
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; field_inst ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let field_inst := M.alloc (| field_inst |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_field_handle_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| field_inst |),
                              "move_binary_format::file_format::FieldInstantiation",
                              "handle"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| field_inst |),
                              "move_binary_format::file_format::FieldInstantiation",
                              "type_parameters"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_field_instantiation :
    M.IsFunction
      "move_binary_format::serializer::serialize_field_instantiation"
      serialize_field_instantiation.
  
  (*
  fn serialize_acquires(binary: &mut BinaryData, indices: &[StructDefinitionIndex]) -> Result<()> {
      serialize_acquires_count(binary, indices.len())?;
      for def_idx in indices {
          serialize_struct_def_index(binary, def_idx)?;
      }
      Ok(())
  }
  *)
  Definition serialize_acquires (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; indices ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let indices := M.alloc (| indices |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_acquires_count",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::StructDefinitionIndex"
                                  ],
                                "len",
                                []
                              |),
                              [ M.read (| indices |) ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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::StructDefinitionIndex" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| indices |) ]
                      |)
                    |),
                    [
                      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::StructDefinitionIndex"
                                          ],
                                        [],
                                        "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 def_idx := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_struct_def_index",
                                                      []
                                                    |),
                                                    [ M.read (| binary |); M.read (| def_idx |) ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_acquires :
    M.IsFunction "move_binary_format::serializer::serialize_acquires" serialize_acquires.
  
  (*
  fn serialize_signature(binary: &mut BinaryData, signature: &Signature) -> Result<()> {
      serialize_signature_tokens(binary, &signature.0)
  }
  *)
  Definition serialize_signature (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; signature ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let signature := M.alloc (| signature |) in
        M.call_closure (|
          M.get_function (| "move_binary_format::serializer::serialize_signature_tokens", [] |),
          [
            M.read (| binary |);
            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 (| signature |),
                  "move_binary_format::file_format::Signature",
                  0
                |)
              ]
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_signature :
    M.IsFunction "move_binary_format::serializer::serialize_signature" serialize_signature.
  
  (*
  fn serialize_signature_tokens(binary: &mut BinaryData, tokens: &[SignatureToken]) -> Result<()> {
      serialize_signature_size(binary, tokens.len())?;
      for token in tokens {
          serialize_signature_token(binary, token)?;
      }
      Ok(())
  }
  *)
  Definition serialize_signature_tokens (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; tokens ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let tokens := M.alloc (| tokens |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_size",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::SignatureToken" ],
                                "len",
                                []
                              |),
                              [ M.read (| tokens |) ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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::SignatureToken" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| tokens |) ]
                      |)
                    |),
                    [
                      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::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 token := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_signature_token",
                                                      []
                                                    |),
                                                    [ M.read (| binary |); M.read (| token |) ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_signature_tokens :
    M.IsFunction
      "move_binary_format::serializer::serialize_signature_tokens"
      serialize_signature_tokens.
  
  (*
  fn serialize_signature_token_single_node_impl(
      binary: &mut BinaryData,
      token: &SignatureToken,
  ) -> Result<()> {
      match token {
          SignatureToken::Bool => binary.push(SerializedType::BOOL as u8)?,
          SignatureToken::U8 => binary.push(SerializedType::U8 as u8)?,
          SignatureToken::U16 => binary.push(SerializedType::U16 as u8)?,
          SignatureToken::U32 => binary.push(SerializedType::U32 as u8)?,
          SignatureToken::U64 => binary.push(SerializedType::U64 as u8)?,
          SignatureToken::U128 => binary.push(SerializedType::U128 as u8)?,
          SignatureToken::U256 => binary.push(SerializedType::U256 as u8)?,
          SignatureToken::Address => binary.push(SerializedType::ADDRESS as u8)?,
          SignatureToken::Signer => binary.push(SerializedType::SIGNER as u8)?,
          SignatureToken::Vector(_) => {
              binary.push(SerializedType::VECTOR as u8)?;
          }
          SignatureToken::Struct(idx) => {
              binary.push(SerializedType::STRUCT as u8)?;
              serialize_struct_handle_index(binary, idx)?;
          }
          SignatureToken::StructInstantiation(struct_inst) => {
              let (idx, type_params) = &**struct_inst;
              binary.push(SerializedType::STRUCT_INST as u8)?;
              serialize_struct_handle_index(binary, idx)?;
              serialize_signature_size(binary, type_params.len())?;
          }
          SignatureToken::Reference(_) => {
              binary.push(SerializedType::REFERENCE as u8)?;
          }
          SignatureToken::MutableReference(_) => {
              binary.push(SerializedType::MUTABLE_REFERENCE as u8)?;
          }
          SignatureToken::TypeParameter(idx) => {
              binary.push(SerializedType::TYPE_PARAMETER as u8)?;
              serialize_type_parameter_index(binary, *idx)?;
          }
      }
      Ok(())
  }
  *)
  Definition serialize_signature_token_single_node_impl
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; token ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let token := M.alloc (| token |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ _ :=
                M.match_operator (|
                  token,
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::Bool"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::BOOL_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::U8"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::U8_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::U16"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::U16_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::U32"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::U32_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::U64"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::U64_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::U128"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::U128_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::U256"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::U256_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::Address"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::ADDRESS_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let _ :=
                          M.is_struct_tuple (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::Signer"
                          |) 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 "anyhow::Error" ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format_common::BinaryData",
                                    "push",
                                    []
                                  |),
                                  [
                                    M.read (| binary |);
                                    M.rust_cast
                                      (BinOp.Wrap.add (|
                                        M.get_constant (|
                                          "move_binary_format::file_format_common::SerializedType::SIGNER_discriminant"
                                        |),
                                        Value.Integer IntegerKind.U8 0
                                      |))
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            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 "anyhow::Error" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path "anyhow::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let γ1_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::Vector",
                            0
                          |) 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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "push",
                                      []
                                    |),
                                    [
                                      M.read (| binary |);
                                      M.rust_cast
                                        (BinOp.Wrap.add (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::SerializedType::VECTOR_discriminant"
                                          |),
                                          Value.Integer IntegerKind.U8 0
                                        |))
                                    ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let γ1_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::Struct",
                            0
                          |) in
                        let idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "push",
                                      []
                                    |),
                                    [
                                      M.read (| binary |);
                                      M.rust_cast
                                        (BinOp.Wrap.add (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::SerializedType::STRUCT_discriminant"
                                          |),
                                          Value.Integer IntegerKind.U8 0
                                        |))
                                    ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        let~ _ :=
                          M.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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "move_binary_format::serializer::serialize_struct_handle_index",
                                      []
                                    |),
                                    [ M.read (| binary |); M.read (| idx |) ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let γ1_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::StructInstantiation",
                            0
                          |) in
                        let struct_inst := M.alloc (| γ1_0 |) in
                        M.match_operator (|
                          M.alloc (| M.read (| M.read (| struct_inst |) |) |),
                          [
                            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 idx := M.alloc (| γ1_0 |) in
                                let type_params := 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 "anyhow::Error" ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path
                                                "move_binary_format::file_format_common::BinaryData",
                                              "push",
                                              []
                                            |),
                                            [
                                              M.read (| binary |);
                                              M.rust_cast
                                                (BinOp.Wrap.add (|
                                                  M.get_constant (|
                                                    "move_binary_format::file_format_common::SerializedType::STRUCT_INST_discriminant"
                                                  |),
                                                  Value.Integer IntegerKind.U8 0
                                                |))
                                            ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      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 "anyhow::Error" ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path "anyhow::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |) in
                                let~ _ :=
                                  M.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 "anyhow::Error" ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_binary_format::serializer::serialize_struct_handle_index",
                                              []
                                            |),
                                            [ M.read (| binary |); M.read (| idx |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      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 "anyhow::Error" ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path "anyhow::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |) in
                                let~ _ :=
                                  M.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 "anyhow::Error" ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_binary_format::serializer::serialize_signature_size",
                                              []
                                            |),
                                            [
                                              M.read (| binary |);
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply
                                                    (Ty.path "alloc::vec::Vec")
                                                    []
                                                    [
                                                      Ty.path
                                                        "move_binary_format::file_format::SignatureToken";
                                                      Ty.path "alloc::alloc::Global"
                                                    ],
                                                  "len",
                                                  []
                                                |),
                                                [ M.read (| type_params |) ]
                                              |)
                                            ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      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 "anyhow::Error" ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path "anyhow::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                          ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let γ1_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::Reference",
                            0
                          |) 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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "push",
                                      []
                                    |),
                                    [
                                      M.read (| binary |);
                                      M.rust_cast
                                        (BinOp.Wrap.add (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::SerializedType::REFERENCE_discriminant"
                                          |),
                                          Value.Integer IntegerKind.U8 0
                                        |))
                                    ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let γ1_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::MutableReference",
                            0
                          |) 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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "push",
                                      []
                                    |),
                                    [
                                      M.read (| binary |);
                                      M.rust_cast
                                        (BinOp.Wrap.add (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::SerializedType::MUTABLE_REFERENCE_discriminant"
                                          |),
                                          Value.Integer IntegerKind.U8 0
                                        |))
                                    ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        let γ1_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "move_binary_format::file_format::SignatureToken::TypeParameter",
                            0
                          |) in
                        let idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format_common::BinaryData",
                                      "push",
                                      []
                                    |),
                                    [
                                      M.read (| binary |);
                                      M.rust_cast
                                        (BinOp.Wrap.add (|
                                          M.get_constant (|
                                            "move_binary_format::file_format_common::SerializedType::TYPE_PARAMETER_discriminant"
                                          |),
                                          Value.Integer IntegerKind.U8 0
                                        |))
                                    ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        let~ _ :=
                          M.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 "anyhow::Error" ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "move_binary_format::serializer::serialize_type_parameter_index",
                                      []
                                    |),
                                    [ M.read (| binary |); M.read (| M.read (| idx |) |) ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              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 "anyhow::Error" ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "anyhow::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_signature_token_single_node_impl :
    M.IsFunction
      "move_binary_format::serializer::serialize_signature_token_single_node_impl"
      serialize_signature_token_single_node_impl.
  
  (*
  pub(crate) fn serialize_signature_token(
      binary: &mut BinaryData,
      token: &SignatureToken,
  ) -> Result<()> {
      // Non-recursive implementation to avoid overflowing the stack.
      for (token, depth) in token.preorder_traversal_with_depth() {
          if depth > SIGNATURE_TOKEN_DEPTH_MAX {
              bail!("max recursion depth reached")
          }
          serialize_signature_token_single_node_impl(binary, token)?;
      }
      Ok(())
  }
  *)
  Definition serialize_signature_token (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; token ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let token := M.alloc (| token |) 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.path
                            "move_binary_format::file_format::SignatureTokenPreorderTraversalIterWithDepth",
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::file_format::SignatureToken",
                              "preorder_traversal_with_depth",
                              []
                            |),
                            [ M.read (| token |) ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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.path
                                          "move_binary_format::file_format::SignatureTokenPreorderTraversalIterWithDepth",
                                        [],
                                        "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 token := M.copy (| γ1_0 |) in
                                        let depth := M.copy (| γ1_1 |) in
                                        let~ _ :=
                                          M.match_operator (|
                                            M.alloc (| Value.Tuple [] |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ :=
                                                    M.use
                                                      (M.alloc (|
                                                        BinOp.gt (|
                                                          M.read (| depth |),
                                                          M.read (|
                                                            M.get_constant (|
                                                              "move_binary_format::file_format_common::SIGNATURE_TOKEN_DEPTH_MAX"
                                                            |)
                                                          |)
                                                        |)
                                                      |)) 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.read (|
                                                                let~ error :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_function (|
                                                                        "anyhow::__private::format_err",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.path
                                                                              "core::fmt::Arguments",
                                                                            "new_const",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.alloc (|
                                                                              Value.Array
                                                                                [
                                                                                  M.read (|
                                                                                    Value.String
                                                                                      "max recursion depth reached"
                                                                                  |)
                                                                                ]
                                                                            |)
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                error
                                                              |)
                                                            ]
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_signature_token_single_node_impl",
                                                      []
                                                    |),
                                                    [ M.read (| binary |); M.read (| token |) ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_signature_token :
    M.IsFunction
      "move_binary_format::serializer::serialize_signature_token"
      serialize_signature_token.
  
  (*
  fn serialize_ability_set(binary: &mut BinaryData, set: AbilitySet) -> Result<()> {
      write_as_uleb128(binary, set.into_u8(), AbilitySet::ALL.into_u8())?;
      Ok(())
  }
  *)
  Definition serialize_ability_set (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; set ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let set := M.alloc (| set |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::write_as_uleb128",
                            [ Ty.path "u8"; Ty.path "u8" ]
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format::AbilitySet",
                                "into_u8",
                                []
                              |),
                              [ M.read (| set |) ]
                            |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format::AbilitySet",
                                "into_u8",
                                []
                              |),
                              [
                                M.read (|
                                  M.get_constant (| "move_binary_format::file_format::ALL" |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_ability_set :
    M.IsFunction "move_binary_format::serializer::serialize_ability_set" serialize_ability_set.
  
  (*
  fn serialize_ability_sets(binary: &mut BinaryData, sets: &[AbilitySet]) -> Result<()> {
      serialize_type_parameter_count(binary, sets.len())?;
      for set in sets {
          serialize_ability_set(binary, *set)?;
      }
      Ok(())
  }
  *)
  Definition serialize_ability_sets (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ binary; sets ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let sets := M.alloc (| sets |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_type_parameter_count",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::AbilitySet" ],
                                "len",
                                []
                              |),
                              [ M.read (| sets |) ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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::AbilitySet" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| sets |) ]
                      |)
                    |),
                    [
                      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::AbilitySet" ],
                                        [],
                                        "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 set := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_ability_set",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| binary |);
                                                      M.read (| M.read (| set |) |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_ability_sets :
    M.IsFunction "move_binary_format::serializer::serialize_ability_sets" serialize_ability_sets.
  
  (*
  fn serialize_code_unit(major_version: u32, binary: &mut BinaryData, code: &CodeUnit) -> Result<()> {
      serialize_signature_index(binary, &code.locals)?;
      serialize_code(major_version, binary, &code.code)
  }
  *)
  Definition serialize_code_unit (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ major_version; binary; code ] =>
      ltac:(M.monadic
        (let major_version := M.alloc (| major_version |) in
        let binary := M.alloc (| binary |) in
        let code := M.alloc (| code |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_signature_index",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| code |),
                              "move_binary_format::file_format::CodeUnit",
                              "locals"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "move_binary_format::serializer::serialize_code", [] |),
                  [
                    M.read (| major_version |);
                    M.read (| binary |);
                    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.SubPointer.get_struct_record_field (|
                          M.read (| code |),
                          "move_binary_format::file_format::CodeUnit",
                          "code"
                        |)
                      ]
                    |)
                  ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_code_unit :
    M.IsFunction "move_binary_format::serializer::serialize_code_unit" serialize_code_unit.
  
  (*
  fn serialize_instruction_inner(
      major_version: u32,
      binary: &mut BinaryData,
      opcode: &Bytecode,
  ) -> Result<()> {
      match opcode {
          Bytecode::LdU16(_)
          | Bytecode::LdU32(_)
          | Bytecode::LdU256(_)
          | Bytecode::CastU16
          | Bytecode::CastU32
          | Bytecode::CastU256
              if (major_version < VERSION_6) =>
          {
              return Err(anyhow!(
                  "Loading or casting u16, u32, u256 integers not supported in bytecode version {}",
                  major_version
              ));
          }
          _ => (),
      };
  
      let res = match opcode {
          Bytecode::FreezeRef => binary.push(Opcodes::FREEZE_REF as u8),
          Bytecode::Pop => binary.push(Opcodes::POP as u8),
          Bytecode::Ret => binary.push(Opcodes::RET as u8),
          Bytecode::BrTrue(code_offset) => {
              binary.push(Opcodes::BR_TRUE as u8)?;
              serialize_bytecode_offset(binary, *code_offset)
          }
          Bytecode::BrFalse(code_offset) => {
              binary.push(Opcodes::BR_FALSE as u8)?;
              serialize_bytecode_offset(binary, *code_offset)
          }
          Bytecode::Branch(code_offset) => {
              binary.push(Opcodes::BRANCH as u8)?;
              serialize_bytecode_offset(binary, *code_offset)
          }
          Bytecode::LdU8(value) => {
              binary.push(Opcodes::LD_U8 as u8)?;
              binary.push( *value)
          }
          Bytecode::LdU64(value) => {
              binary.push(Opcodes::LD_U64 as u8)?;
              write_u64(binary, *value)
          }
          Bytecode::LdU128(value) => {
              binary.push(Opcodes::LD_U128 as u8)?;
              write_u128(binary, **value)
          }
          Bytecode::CastU8 => binary.push(Opcodes::CAST_U8 as u8),
          Bytecode::CastU64 => binary.push(Opcodes::CAST_U64 as u8),
          Bytecode::CastU128 => binary.push(Opcodes::CAST_U128 as u8),
          Bytecode::LdConst(const_idx) => {
              binary.push(Opcodes::LD_CONST as u8)?;
              serialize_constant_pool_index(binary, const_idx)
          }
          Bytecode::LdTrue => binary.push(Opcodes::LD_TRUE as u8),
          Bytecode::LdFalse => binary.push(Opcodes::LD_FALSE as u8),
          Bytecode::CopyLoc(local_idx) => {
              binary.push(Opcodes::COPY_LOC as u8)?;
              serialize_local_index(binary, *local_idx)
          }
          Bytecode::MoveLoc(local_idx) => {
              binary.push(Opcodes::MOVE_LOC as u8)?;
              serialize_local_index(binary, *local_idx)
          }
          Bytecode::StLoc(local_idx) => {
              binary.push(Opcodes::ST_LOC as u8)?;
              serialize_local_index(binary, *local_idx)
          }
          Bytecode::MutBorrowLoc(local_idx) => {
              binary.push(Opcodes::MUT_BORROW_LOC as u8)?;
              serialize_local_index(binary, *local_idx)
          }
          Bytecode::ImmBorrowLoc(local_idx) => {
              binary.push(Opcodes::IMM_BORROW_LOC as u8)?;
              serialize_local_index(binary, *local_idx)
          }
          Bytecode::MutBorrowField(field_idx) => {
              binary.push(Opcodes::MUT_BORROW_FIELD as u8)?;
              serialize_field_handle_index(binary, field_idx)
          }
          Bytecode::MutBorrowFieldGeneric(field_idx) => {
              binary.push(Opcodes::MUT_BORROW_FIELD_GENERIC as u8)?;
              serialize_field_inst_index(binary, field_idx)
          }
          Bytecode::ImmBorrowField(field_idx) => {
              binary.push(Opcodes::IMM_BORROW_FIELD as u8)?;
              serialize_field_handle_index(binary, field_idx)
          }
          Bytecode::ImmBorrowFieldGeneric(field_idx) => {
              binary.push(Opcodes::IMM_BORROW_FIELD_GENERIC as u8)?;
              serialize_field_inst_index(binary, field_idx)
          }
          Bytecode::Call(method_idx) => {
              binary.push(Opcodes::CALL as u8)?;
              serialize_function_handle_index(binary, method_idx)
          }
          Bytecode::Pack(class_idx) => {
              binary.push(Opcodes::PACK as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::Unpack(class_idx) => {
              binary.push(Opcodes::UNPACK as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::CallGeneric(method_idx) => {
              binary.push(Opcodes::CALL_GENERIC as u8)?;
              serialize_function_inst_index(binary, method_idx)
          }
          Bytecode::PackGeneric(class_idx) => {
              binary.push(Opcodes::PACK_GENERIC as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::UnpackGeneric(class_idx) => {
              binary.push(Opcodes::UNPACK_GENERIC as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::ReadRef => binary.push(Opcodes::READ_REF as u8),
          Bytecode::WriteRef => binary.push(Opcodes::WRITE_REF as u8),
          Bytecode::Add => binary.push(Opcodes::ADD as u8),
          Bytecode::Sub => binary.push(Opcodes::SUB as u8),
          Bytecode::Mul => binary.push(Opcodes::MUL as u8),
          Bytecode::Mod => binary.push(Opcodes::MOD as u8),
          Bytecode::Div => binary.push(Opcodes::DIV as u8),
          Bytecode::BitOr => binary.push(Opcodes::BIT_OR as u8),
          Bytecode::BitAnd => binary.push(Opcodes::BIT_AND as u8),
          Bytecode::Xor => binary.push(Opcodes::XOR as u8),
          Bytecode::Shl => binary.push(Opcodes::SHL as u8),
          Bytecode::Shr => binary.push(Opcodes::SHR as u8),
          Bytecode::Or => binary.push(Opcodes::OR as u8),
          Bytecode::And => binary.push(Opcodes::AND as u8),
          Bytecode::Not => binary.push(Opcodes::NOT as u8),
          Bytecode::Eq => binary.push(Opcodes::EQ as u8),
          Bytecode::Neq => binary.push(Opcodes::NEQ as u8),
          Bytecode::Lt => binary.push(Opcodes::LT as u8),
          Bytecode::Gt => binary.push(Opcodes::GT as u8),
          Bytecode::Le => binary.push(Opcodes::LE as u8),
          Bytecode::Ge => binary.push(Opcodes::GE as u8),
          Bytecode::Abort => binary.push(Opcodes::ABORT as u8),
          Bytecode::Nop => binary.push(Opcodes::NOP as u8),
          Bytecode::ExistsDeprecated(class_idx) => {
              binary.push(Opcodes::EXISTS_DEPRECATED as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::MutBorrowGlobalDeprecated(class_idx) => {
              binary.push(Opcodes::MUT_BORROW_GLOBAL_DEPRECATED as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::ImmBorrowGlobalDeprecated(class_idx) => {
              binary.push(Opcodes::IMM_BORROW_GLOBAL_DEPRECATED as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::MoveFromDeprecated(class_idx) => {
              binary.push(Opcodes::MOVE_FROM_DEPRECATED as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::MoveToDeprecated(class_idx) => {
              binary.push(Opcodes::MOVE_TO_DEPRECATED as u8)?;
              serialize_struct_def_index(binary, class_idx)
          }
          Bytecode::ExistsGenericDeprecated(class_idx) => {
              binary.push(Opcodes::EXISTS_GENERIC_DEPRECATED as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::MutBorrowGlobalGenericDeprecated(class_idx) => {
              binary.push(Opcodes::MUT_BORROW_GLOBAL_GENERIC_DEPRECATED as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::ImmBorrowGlobalGenericDeprecated(class_idx) => {
              binary.push(Opcodes::IMM_BORROW_GLOBAL_GENERIC_DEPRECATED as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::MoveFromGenericDeprecated(class_idx) => {
              binary.push(Opcodes::MOVE_FROM_GENERIC_DEPRECATED as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::MoveToGenericDeprecated(class_idx) => {
              binary.push(Opcodes::MOVE_TO_GENERIC_DEPRECATED as u8)?;
              serialize_struct_def_inst_index(binary, class_idx)
          }
          Bytecode::VecPack(sig_idx, num) => {
              binary.push(Opcodes::VEC_PACK as u8)?;
              serialize_signature_index(binary, sig_idx)?;
              write_u64(binary, *num)
          }
          Bytecode::VecLen(sig_idx) => {
              binary.push(Opcodes::VEC_LEN as u8)?;
              serialize_signature_index(binary, sig_idx)
          }
          Bytecode::VecImmBorrow(sig_idx) => {
              binary.push(Opcodes::VEC_IMM_BORROW as u8)?;
              serialize_signature_index(binary, sig_idx)
          }
          Bytecode::VecMutBorrow(sig_idx) => {
              binary.push(Opcodes::VEC_MUT_BORROW as u8)?;
              serialize_signature_index(binary, sig_idx)
          }
          Bytecode::VecPushBack(sig_idx) => {
              binary.push(Opcodes::VEC_PUSH_BACK as u8)?;
              serialize_signature_index(binary, sig_idx)
          }
          Bytecode::VecPopBack(sig_idx) => {
              binary.push(Opcodes::VEC_POP_BACK as u8)?;
              serialize_signature_index(binary, sig_idx)
          }
          Bytecode::VecUnpack(sig_idx, num) => {
              binary.push(Opcodes::VEC_UNPACK as u8)?;
              serialize_signature_index(binary, sig_idx)?;
              write_u64(binary, *num)
          }
          Bytecode::VecSwap(sig_idx) => {
              binary.push(Opcodes::VEC_SWAP as u8)?;
              serialize_signature_index(binary, sig_idx)
          }
          Bytecode::LdU16(value) => {
              binary.push(Opcodes::LD_U16 as u8)?;
              write_u16(binary, *value)
          }
          Bytecode::LdU32(value) => {
              binary.push(Opcodes::LD_U32 as u8)?;
              write_u32(binary, *value)
          }
          Bytecode::LdU256(value) => {
              binary.push(Opcodes::LD_U256 as u8)?;
              write_u256(binary, **value)
          }
          Bytecode::CastU16 => binary.push(Opcodes::CAST_U16 as u8),
          Bytecode::CastU32 => binary.push(Opcodes::CAST_U32 as u8),
          Bytecode::CastU256 => binary.push(Opcodes::CAST_U256 as u8),
      };
      res?;
      Ok(())
  }
  *)
  Definition serialize_instruction_inner
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ major_version; binary; opcode ] =>
      ltac:(M.monadic
        (let major_version := M.alloc (| major_version |) in
        let binary := M.alloc (| binary |) in
        let opcode := M.alloc (| opcode |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ _ :=
                M.match_operator (|
                  opcode,
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (M.find_or_pattern (|
                          γ,
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ := M.read (| γ |) in
                                let γ1_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "move_binary_format::file_format::Bytecode::LdU16",
                                    0
                                  |) in
                                Value.Tuple []));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ := M.read (| γ |) in
                                let γ1_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "move_binary_format::file_format::Bytecode::LdU32",
                                    0
                                  |) in
                                Value.Tuple []));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ := M.read (| γ |) in
                                let γ1_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "move_binary_format::file_format::Bytecode::LdU256",
                                    0
                                  |) in
                                Value.Tuple []));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ := M.read (| γ |) in
                                let _ :=
                                  M.is_struct_tuple (|
                                    γ,
                                    "move_binary_format::file_format::Bytecode::CastU16"
                                  |) in
                                Value.Tuple []));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ := M.read (| γ |) in
                                let _ :=
                                  M.is_struct_tuple (|
                                    γ,
                                    "move_binary_format::file_format::Bytecode::CastU32"
                                  |) in
                                Value.Tuple []));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ := M.read (| γ |) in
                                let _ :=
                                  M.is_struct_tuple (|
                                    γ,
                                    "move_binary_format::file_format::Bytecode::CastU256"
                                  |) in
                                Value.Tuple []))
                          ],
                          M.closure
                            (fun γ =>
                              ltac:(M.monadic
                                match γ with
                                | [] =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.alloc (|
                                        BinOp.lt (|
                                          M.read (| major_version |),
                                          M.read (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::VERSION_6"
                                            |)
                                          |)
                                        |)
                                      |) 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 "anyhow::Error",
                                                    "msg",
                                                    [ Ty.path "alloc::string::String" ]
                                                  |),
                                                  [
                                                    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
                                                                                "Loading or casting u16, u32, u256 integers not supported in bytecode version "
                                                                            |)
                                                                          ]
                                                                      |);
                                                                      M.alloc (|
                                                                        Value.Array
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_associated_function (|
                                                                                Ty.path
                                                                                  "core::fmt::rt::Argument",
                                                                                "new_display",
                                                                                [ Ty.path "u32" ]
                                                                              |),
                                                                              [ major_version ]
                                                                            |)
                                                                          ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          res
                                                        |)
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              ]
                                          |)
                                        |)
                                      |)
                                    |)))
                                | _ => M.impossible "wrong number of arguments"
                                end))
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ res :=
                M.copy (|
                  M.match_operator (|
                    opcode,
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::FreezeRef"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::FREEZE_REF_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Pop"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::POP_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Ret"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::RET_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::BrTrue",
                              0
                            |) in
                          let code_offset := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::BR_TRUE_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_bytecode_offset",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| code_offset |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::BrFalse",
                              0
                            |) in
                          let code_offset := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::BR_FALSE_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_bytecode_offset",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| code_offset |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Branch",
                              0
                            |) in
                          let code_offset := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::BRANCH_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_bytecode_offset",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| code_offset |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdU8",
                              0
                            |) in
                          let value := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_U8_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| value |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdU64",
                              0
                            |) in
                          let value := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_U64_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u64",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| value |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdU128",
                              0
                            |) in
                          let value := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_U128_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u128",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| M.read (| value |) |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CastU8"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::CAST_U8_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CastU64"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::CAST_U64_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CastU128"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::CAST_U128_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdConst",
                              0
                            |) in
                          let const_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_CONST_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_constant_pool_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| const_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdTrue"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::LD_TRUE_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdFalse"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::LD_FALSE_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CopyLoc",
                              0
                            |) in
                          let local_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::COPY_LOC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_local_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| local_idx |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MoveLoc",
                              0
                            |) in
                          let local_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MOVE_LOC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_local_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| local_idx |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::StLoc",
                              0
                            |) in
                          let local_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::ST_LOC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_local_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| local_idx |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MutBorrowLoc",
                              0
                            |) in
                          let local_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MUT_BORROW_LOC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_local_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| local_idx |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ImmBorrowLoc",
                              0
                            |) in
                          let local_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::IMM_BORROW_LOC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_local_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| local_idx |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MutBorrowField",
                              0
                            |) in
                          let field_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MUT_BORROW_FIELD_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_field_handle_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| field_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MutBorrowFieldGeneric",
                              0
                            |) in
                          let field_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MUT_BORROW_FIELD_GENERIC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_field_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| field_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ImmBorrowField",
                              0
                            |) in
                          let field_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::IMM_BORROW_FIELD_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_field_handle_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| field_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ImmBorrowFieldGeneric",
                              0
                            |) in
                          let field_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::IMM_BORROW_FIELD_GENERIC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_field_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| field_idx |) ]
                            |)
                          |)));
                      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 method_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::CALL_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_function_handle_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| method_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Pack",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::PACK_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Unpack",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::UNPACK_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_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 method_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::CALL_GENERIC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_function_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| method_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::PackGeneric",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::PACK_GENERIC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::UnpackGeneric",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::UNPACK_GENERIC_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ReadRef"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::READ_REF_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::WriteRef"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::WRITE_REF_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Add"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::ADD_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Sub"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::SUB_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Mul"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::MUL_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Mod"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::MOD_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Div"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::DIV_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::BitOr"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::BIT_OR_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::BitAnd"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::BIT_AND_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Xor"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::XOR_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Shl"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::SHL_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Shr"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::SHR_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Or"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::OR_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::And"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::AND_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Not"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::NOT_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Eq"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::EQ_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Neq"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::NEQ_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Lt"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::LT_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Gt"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::GT_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Le"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::LE_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Ge"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::GE_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Abort"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::ABORT_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::Nop"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::NOP_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ExistsDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::EXISTS_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MutBorrowGlobalDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MUT_BORROW_GLOBAL_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ImmBorrowGlobalDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::IMM_BORROW_GLOBAL_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MoveFromDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MOVE_FROM_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MoveToDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MOVE_TO_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ExistsGenericDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::EXISTS_GENERIC_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MutBorrowGlobalGenericDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MUT_BORROW_GLOBAL_GENERIC_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::ImmBorrowGlobalGenericDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::IMM_BORROW_GLOBAL_GENERIC_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MoveFromGenericDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MOVE_FROM_GENERIC_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::MoveToGenericDeprecated",
                              0
                            |) in
                          let class_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::MOVE_TO_GENERIC_DEPRECATED_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_struct_def_inst_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| class_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecPack",
                              0
                            |) in
                          let γ1_1 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecPack",
                              1
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) in
                          let num := 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_PACK_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          let~ _ :=
                            M.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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_binary_format::serializer::serialize_signature_index",
                                        []
                                      |),
                                      [ M.read (| binary |); M.read (| sig_idx |) ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u64",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| num |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecLen",
                              0
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_LEN_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_signature_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| sig_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecImmBorrow",
                              0
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_IMM_BORROW_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_signature_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| sig_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecMutBorrow",
                              0
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_MUT_BORROW_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_signature_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| sig_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecPushBack",
                              0
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_PUSH_BACK_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_signature_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| sig_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecPopBack",
                              0
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_POP_BACK_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_signature_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| sig_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecUnpack",
                              0
                            |) in
                          let γ1_1 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecUnpack",
                              1
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) in
                          let num := 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_UNPACK_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          let~ _ :=
                            M.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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_binary_format::serializer::serialize_signature_index",
                                        []
                                      |),
                                      [ M.read (| binary |); M.read (| sig_idx |) ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u64",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| num |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::VecSwap",
                              0
                            |) in
                          let sig_idx := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::VEC_SWAP_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::serializer::serialize_signature_index",
                                []
                              |),
                              [ M.read (| binary |); M.read (| sig_idx |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdU16",
                              0
                            |) in
                          let value := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_U16_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u16",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| value |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdU32",
                              0
                            |) in
                          let value := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_U32_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u32",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| value |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "move_binary_format::file_format::Bytecode::LdU256",
                              0
                            |) in
                          let value := M.alloc (| γ1_0 |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.get_constant (|
                                              "move_binary_format::file_format_common::Opcodes::LD_U256_discriminant"
                                            |),
                                            Value.Integer IntegerKind.U8 0
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "move_binary_format::file_format_common::write_u256",
                                []
                              |),
                              [ M.read (| binary |); M.read (| M.read (| M.read (| value |) |) |) ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CastU16"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::CAST_U16_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CastU32"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::CAST_U32_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (|
                              γ,
                              "move_binary_format::file_format::Bytecode::CastU256"
                            |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_binary_format::file_format_common::BinaryData",
                                "push",
                                []
                              |),
                              [
                                M.read (| binary |);
                                M.rust_cast
                                  (BinOp.Wrap.add (|
                                    M.get_constant (|
                                      "move_binary_format::file_format_common::Opcodes::CAST_U256_discriminant"
                                    |),
                                    Value.Integer IntegerKind.U8 0
                                  |))
                              ]
                            |)
                          |)))
                    ]
                  |)
                |) 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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [ M.read (| res |) ]
                    |)
                  |),
                  [
                    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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_serialize_instruction_inner :
    M.IsFunction
      "move_binary_format::serializer::serialize_instruction_inner"
      serialize_instruction_inner.
  
  (*
  fn serialize_code(major_version: u32, binary: &mut BinaryData, code: &[Bytecode]) -> Result<()> {
      serialize_bytecode_count(binary, code.len())?;
      for opcode in code {
          serialize_instruction_inner(major_version, binary, opcode)?;
      }
      Ok(())
  }
  *)
  Definition serialize_code (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ major_version; binary; code ] =>
      ltac:(M.monadic
        (let major_version := M.alloc (| major_version |) in
        let binary := M.alloc (| binary |) in
        let code := M.alloc (| code |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              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 "anyhow::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_binary_format::serializer::serialize_bytecode_count",
                            []
                          |),
                          [
                            M.read (| binary |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::Bytecode" ],
                                "len",
                                []
                              |),
                              [ 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 "anyhow::Error" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "anyhow::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              let~ _ :=
                M.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::Bytecode" ]
                            ],
                          [],
                          "into_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::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 opcode := M.copy (| γ0_0 |) 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 "anyhow::Error" ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_binary_format::serializer::serialize_instruction_inner",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| major_version |);
                                                      M.read (| binary |);
                                                      M.read (| opcode |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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 "anyhow::Error"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path "anyhow::Error"
                                                                  ]
                                                              ],
                                                              "from_residual",
                                                              []
                                                            |),
                                                            [ M.read (| residual |) ]
                                                          |)
                                                        |)
                                                      |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::ops::control_flow::ControlFlow::Continue",
                                                      0
                                                    |) in
                                                  let val := M.copy (| γ0_0 |) in
                                                  val))
                                            ]
                                          |) in
                                        M.alloc (| Value.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_serialize_code :
    M.IsFunction "move_binary_format::serializer::serialize_code" serialize_code.
  
  (*
  fn checked_calculate_table_size(binary: &mut BinaryData, start: u32) -> Result<u32> {
      let offset = check_index_in_binary(binary.len())?;
      assert!(offset >= start, "table start must be before end");
      Ok(offset - start)
  }
  *)
  Definition checked_calculate_table_size
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ binary; start ] =>
      ltac:(M.monadic
        (let binary := M.alloc (| binary |) in
        let start := M.alloc (| start |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ offset :=
                M.copy (|
                  M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::check_index_in_binary",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "move_binary_format::file_format_common::BinaryData",
                                  "len",
                                  []
                                |),
                                [ M.read (| binary |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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.path "u32"; Ty.path "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |)
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              UnOp.not (| BinOp.ge (| M.read (| offset |), M.read (| start |) |) |)
                            |)) 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_const",
                                    []
                                  |),
                                  [
                                    M.alloc (|
                                      Value.Array
                                        [ M.read (| Value.String "table start must be before end" |)
                                        ]
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              M.alloc (|
                Value.StructTuple
                  "core::result::Result::Ok"
                  [ BinOp.Wrap.sub (| M.read (| offset |), M.read (| start |) |) ]
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_checked_calculate_table_size :
    M.IsFunction
      "move_binary_format::serializer::checked_calculate_table_size"
      checked_calculate_table_size.
  
  Module Impl_move_binary_format_serializer_CommonSerializer.
    Definition Self : Ty.t := Ty.path "move_binary_format::serializer::CommonSerializer".
    
    (*
        pub fn new(major_version: u32) -> CommonSerializer {
            CommonSerializer {
                major_version,
                table_count: 0,
                module_handles: (0, 0),
                struct_handles: (0, 0),
                function_handles: (0, 0),
                function_instantiations: (0, 0),
                signatures: (0, 0),
                identifiers: (0, 0),
                address_identifiers: (0, 0),
                constant_pool: (0, 0),
                metadata: (0, 0),
            }
        }
    *)
    Definition new (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ major_version ] =>
        ltac:(M.monadic
          (let major_version := M.alloc (| major_version |) in
          Value.StructRecord
            "move_binary_format::serializer::CommonSerializer"
            [
              ("major_version", M.read (| major_version |));
              ("table_count", Value.Integer IntegerKind.U8 0);
              ("module_handles",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("struct_handles",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("function_handles",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("function_instantiations",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("signatures",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("identifiers",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("address_identifiers",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("constant_pool",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("metadata",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ])
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new.
    
    (*
        fn serialize_header(&mut self, binary: &mut BinaryData) -> Result<()> {
            serialize_magic(binary)?;
            write_u32(binary, self.major_version)?;
            Ok(())
        }
    *)
    Definition serialize_header (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_magic",
                              []
                            |),
                            [ M.read (| binary |) ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::file_format_common::write_u32",
                              []
                            |),
                            [
                              M.read (| binary |);
                              M.read (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "major_version"
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_header :
      M.IsAssociatedFunction Self "serialize_header" serialize_header.
    
    (*
        fn serialize_table_indices(&mut self, binary: &mut BinaryData) -> Result<()> {
            serialize_table_count(binary, self.table_count)?;
    
            serialize_table_index(
                binary,
                TableType::MODULE_HANDLES,
                self.module_handles.0,
                self.module_handles.1,
            )?;
            serialize_table_index(
                binary,
                TableType::STRUCT_HANDLES,
                self.struct_handles.0,
                self.struct_handles.1,
            )?;
            serialize_table_index(
                binary,
                TableType::FUNCTION_HANDLES,
                self.function_handles.0,
                self.function_handles.1,
            )?;
            serialize_table_index(
                binary,
                TableType::FUNCTION_INST,
                self.function_instantiations.0,
                self.function_instantiations.1,
            )?;
            serialize_table_index(
                binary,
                TableType::SIGNATURES,
                self.signatures.0,
                self.signatures.1,
            )?;
            serialize_table_index(
                binary,
                TableType::IDENTIFIERS,
                self.identifiers.0,
                self.identifiers.1,
            )?;
            serialize_table_index(
                binary,
                TableType::ADDRESS_IDENTIFIERS,
                self.address_identifiers.0,
                self.address_identifiers.1,
            )?;
            serialize_table_index(
                binary,
                TableType::CONSTANT_POOL,
                self.constant_pool.0,
                self.constant_pool.1,
            )?;
            if self.major_version >= VERSION_5 {
                // Metadata was not introduced before v5, so do not generate it for lower versions.
                serialize_table_index(
                    binary,
                    TableType::METADATA,
                    self.metadata.0,
                    self.metadata.1,
                )?;
            }
            Ok(())
        }
    *)
    Definition serialize_table_indices (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_count",
                              []
                            |),
                            [
                              M.read (| binary |);
                              M.read (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "table_count"
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::MODULE_HANDLES"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "module_handles"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "module_handles"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::STRUCT_HANDLES"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "struct_handles"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "struct_handles"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::FUNCTION_HANDLES"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "function_handles"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "function_handles"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::FUNCTION_INST"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "function_instantiations"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "function_instantiations"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::SIGNATURES"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "signatures"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "signatures"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::IDENTIFIERS"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "identifiers"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "identifiers"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::ADDRESS_IDENTIFIERS"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "address_identifiers"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "address_identifiers"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::CONSTANT_POOL"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "constant_pool"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::CommonSerializer",
                                    "constant_pool"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.ge (|
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "major_version"
                                    |)
                                  |),
                                  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
                          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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_binary_format::serializer::serialize_table_index",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        Value.StructTuple
                                          "move_binary_format::file_format_common::TableType::METADATA"
                                          [];
                                        M.read (|
                                          M.SubPointer.get_tuple_field (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| self |),
                                              "move_binary_format::serializer::CommonSerializer",
                                              "metadata"
                                            |),
                                            0
                                          |)
                                        |);
                                        M.read (|
                                          M.SubPointer.get_tuple_field (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| self |),
                                              "move_binary_format::serializer::CommonSerializer",
                                              "metadata"
                                            |),
                                            1
                                          |)
                                        |)
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_table_indices :
      M.IsAssociatedFunction Self "serialize_table_indices" serialize_table_indices.
    
    (*
        fn serialize_common_tables<T: CommonTables>(
            &mut self,
            binary: &mut BinaryData,
            tables: &T,
        ) -> Result<()> {
            debug_assert!(self.table_count == 0);
            self.serialize_module_handles(binary, tables.get_module_handles())?;
            self.serialize_struct_handles(binary, tables.get_struct_handles())?;
            self.serialize_function_handles(binary, tables.get_function_handles())?;
            debug_assert!(self.table_count < 6);
            self.serialize_function_instantiations(binary, tables.get_function_instantiations())?;
            self.serialize_signatures(binary, tables.get_signatures())?;
            self.serialize_identifiers(binary, tables.get_identifiers())?;
            self.serialize_address_identifiers(binary, tables.get_address_identifiers())?;
            self.serialize_constants(binary, tables.get_constant_pool())?;
            if self.major_version >= VERSION_5 {
                self.serialize_metadata(binary, tables.get_metadata())?;
            }
            Ok(())
        }
    *)
    Definition serialize_common_tables (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ T ], [ self; binary; tables ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let tables := M.alloc (| tables |) 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 (| 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.eq (|
                                              M.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "table_count"
                                                |)
                                              |),
                                              Value.Integer IntegerKind.U8 0
                                            |)
                                          |)
                                        |)) 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: self.table_count == 0"
                                            |)
                                          ]
                                        |)
                                      |)
                                    |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) 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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_module_handles",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_module_handles",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_struct_handles",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_struct_handles",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_function_handles",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_function_handles",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "table_count"
                                                |)
                                              |),
                                              Value.Integer IntegerKind.U8 6
                                            |)
                                          |)
                                        |)) 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: self.table_count < 6"
                                            |)
                                          ]
                                        |)
                                      |)
                                    |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) 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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_function_instantiations",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_function_instantiations",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_signatures",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_signatures",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_identifiers",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_identifiers",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_address_identifiers",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_address_identifiers",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_constants",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "move_binary_format::serializer::CommonTables",
                                  T,
                                  [],
                                  "get_constant_pool",
                                  []
                                |),
                                [ M.read (| tables |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.ge (|
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "major_version"
                                    |)
                                  |),
                                  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
                          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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "move_binary_format::serializer::CommonSerializer",
                                        "serialize_metadata",
                                        []
                                      |),
                                      [
                                        M.read (| self |);
                                        M.read (| binary |);
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "move_binary_format::serializer::CommonTables",
                                            T,
                                            [],
                                            "get_metadata",
                                            []
                                          |),
                                          [ M.read (| tables |) ]
                                        |)
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_common_tables :
      M.IsAssociatedFunction Self "serialize_common_tables" serialize_common_tables.
    
    (*
        fn serialize_module_handles(
            &mut self,
            binary: &mut BinaryData,
            module_handles: &[ModuleHandle],
        ) -> Result<()> {
            if !module_handles.is_empty() {
                self.table_count += 1;
                self.module_handles.0 = check_index_in_binary(binary.len())?;
                for module_handle in module_handles {
                    serialize_module_handle(binary, module_handle)?;
                }
                self.module_handles.1 = checked_calculate_table_size(binary, self.module_handles.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_module_handles (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; module_handles ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let module_handles := M.alloc (| module_handles |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::ModuleHandle" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| module_handles |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "module_handles"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::ModuleHandle"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| module_handles |) ]
                                  |)
                                |),
                                [
                                  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::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 module_handle := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_module_handle",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| module_handle |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "module_handles"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "module_handles"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_module_handles :
      M.IsAssociatedFunction Self "serialize_module_handles" serialize_module_handles.
    
    (*
        fn serialize_struct_handles(
            &mut self,
            binary: &mut BinaryData,
            struct_handles: &[StructHandle],
        ) -> Result<()> {
            if !struct_handles.is_empty() {
                self.table_count += 1;
                self.struct_handles.0 = check_index_in_binary(binary.len())?;
                for struct_handle in struct_handles {
                    serialize_struct_handle(binary, struct_handle)?;
                }
                self.struct_handles.1 = checked_calculate_table_size(binary, self.struct_handles.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_struct_handles (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; struct_handles ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let struct_handles := M.alloc (| struct_handles |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::StructHandle" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| struct_handles |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "struct_handles"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::StructHandle"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| struct_handles |) ]
                                  |)
                                |),
                                [
                                  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::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 struct_handle := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_struct_handle",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| struct_handle |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "struct_handles"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "struct_handles"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_struct_handles :
      M.IsAssociatedFunction Self "serialize_struct_handles" serialize_struct_handles.
    
    (*
        fn serialize_function_handles(
            &mut self,
            binary: &mut BinaryData,
            function_handles: &[FunctionHandle],
        ) -> Result<()> {
            if !function_handles.is_empty() {
                self.table_count += 1;
                self.function_handles.0 = check_index_in_binary(binary.len())?;
                for function_handle in function_handles {
                    serialize_function_handle(binary, function_handle)?;
                }
                self.function_handles.1 =
                    checked_calculate_table_size(binary, self.function_handles.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_function_handles
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; function_handles ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let function_handles := M.alloc (| function_handles |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::FunctionHandle"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| function_handles |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "function_handles"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::FunctionHandle"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| function_handles |) ]
                                  |)
                                |),
                                [
                                  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::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 function_handle := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_function_handle",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| function_handle |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "function_handles"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "function_handles"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_function_handles :
      M.IsAssociatedFunction Self "serialize_function_handles" serialize_function_handles.
    
    (*
        fn serialize_function_instantiations(
            &mut self,
            binary: &mut BinaryData,
            function_instantiations: &[FunctionInstantiation],
        ) -> Result<()> {
            if !function_instantiations.is_empty() {
                self.table_count += 1;
                self.function_instantiations.0 = check_index_in_binary(binary.len())?;
                for function_instantiation in function_instantiations {
                    serialize_function_instantiation(binary, function_instantiation)?;
                }
                self.function_instantiations.1 =
                    checked_calculate_table_size(binary, self.function_instantiations.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_function_instantiations
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; function_instantiations ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let function_instantiations := M.alloc (| function_instantiations |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.path
                                            "move_binary_format::file_format::FunctionInstantiation"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| function_instantiations |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "function_instantiations"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::FunctionInstantiation"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| function_instantiations |) ]
                                  |)
                                |),
                                [
                                  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::FunctionInstantiation"
                                                      ],
                                                    [],
                                                    "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_instantiation :=
                                                      M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_function_instantiation",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (|
                                                                    function_instantiation
                                                                  |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "function_instantiations"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "function_instantiations"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_function_instantiations :
      M.IsAssociatedFunction
        Self
        "serialize_function_instantiations"
        serialize_function_instantiations.
    
    (*
        fn serialize_identifiers(
            &mut self,
            binary: &mut BinaryData,
            identifiers: &[Identifier],
        ) -> Result<()> {
            if !identifiers.is_empty() {
                self.table_count += 1;
                self.identifiers.0 = check_index_in_binary(binary.len())?;
                for identifier in identifiers {
                    // User strings and identifiers use the same serialization.
                    serialize_identifier(binary, identifier.as_str())?;
                }
                self.identifiers.1 = checked_calculate_table_size(binary, self.identifiers.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_identifiers (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; identifiers ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let identifiers := M.alloc (| identifiers |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_core_types::identifier::Identifier" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| identifiers |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "identifiers"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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_core_types::identifier::Identifier" ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| identifiers |) ]
                                  |)
                                |),
                                [
                                  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_core_types::identifier::Identifier"
                                                      ],
                                                    [],
                                                    "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 identifier := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_identifier",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.path
                                                                        "move_core_types::identifier::IdentStr",
                                                                      "as_str",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::Deref",
                                                                          Ty.path
                                                                            "move_core_types::identifier::Identifier",
                                                                          [],
                                                                          "deref",
                                                                          []
                                                                        |),
                                                                        [ M.read (| identifier |) ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "identifiers"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "identifiers"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_identifiers :
      M.IsAssociatedFunction Self "serialize_identifiers" serialize_identifiers.
    
    (*
        fn serialize_address_identifiers(
            &mut self,
            binary: &mut BinaryData,
            addresses: &[AccountAddress],
        ) -> Result<()> {
            if !addresses.is_empty() {
                self.table_count += 1;
                self.address_identifiers.0 = check_index_in_binary(binary.len())?;
                for address in addresses {
                    serialize_address(binary, address)?;
                }
                self.address_identifiers.1 =
                    checked_calculate_table_size(binary, self.address_identifiers.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_address_identifiers
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; addresses ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let addresses := M.alloc (| addresses |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_core_types::account_address::AccountAddress"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| addresses |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "address_identifiers"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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_core_types::account_address::AccountAddress"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| addresses |) ]
                                  |)
                                |),
                                [
                                  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_core_types::account_address::AccountAddress"
                                                      ],
                                                    [],
                                                    "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 address := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_address",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| address |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "address_identifiers"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "address_identifiers"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_address_identifiers :
      M.IsAssociatedFunction Self "serialize_address_identifiers" serialize_address_identifiers.
    
    (*
        fn serialize_constants(
            &mut self,
            binary: &mut BinaryData,
            constants: &[Constant],
        ) -> Result<()> {
            if !constants.is_empty() {
                self.table_count += 1;
                self.constant_pool.0 = check_index_in_binary(binary.len())?;
                for constant in constants {
                    serialize_constant(binary, constant)?;
                }
                self.constant_pool.1 = checked_calculate_table_size(binary, self.constant_pool.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_constants (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; constants ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let constants := M.alloc (| constants |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::Constant" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| constants |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "constant_pool"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::Constant" ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| constants |) ]
                                  |)
                                |),
                                [
                                  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::Constant"
                                                      ],
                                                    [],
                                                    "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 constant := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_constant",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| constant |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "constant_pool"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "constant_pool"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_constants :
      M.IsAssociatedFunction Self "serialize_constants" serialize_constants.
    
    (*
        fn serialize_metadata(&mut self, binary: &mut BinaryData, metadata: &[Metadata]) -> Result<()> {
            if !metadata.is_empty() {
                self.table_count += 1;
                self.metadata.0 = check_index_in_binary(binary.len())?;
                for entry in metadata {
                    serialize_metadata_entry(binary, entry)?;
                }
                self.metadata.1 = checked_calculate_table_size(binary, self.metadata.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_metadata (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; metadata ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let metadata := M.alloc (| metadata |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_core_types::metadata::Metadata" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| metadata |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "metadata"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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_core_types::metadata::Metadata" ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| metadata |) ]
                                  |)
                                |),
                                [
                                  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_core_types::metadata::Metadata"
                                                      ],
                                                    [],
                                                    "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 entry := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_metadata_entry",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| entry |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "metadata"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "metadata"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_metadata :
      M.IsAssociatedFunction Self "serialize_metadata" serialize_metadata.
    
    (*
        fn serialize_signatures(
            &mut self,
            binary: &mut BinaryData,
            signatures: &[Signature],
        ) -> Result<()> {
            if !signatures.is_empty() {
                self.table_count += 1;
                self.signatures.0 = check_index_in_binary(binary.len())?;
                for signature in signatures {
                    serialize_signature(binary, signature)?;
                }
                self.signatures.1 = checked_calculate_table_size(binary, self.signatures.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_signatures (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; signatures ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let signatures := M.alloc (| signatures |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::Signature" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| signatures |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "signatures"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::Signature" ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| signatures |) ]
                                  |)
                                |),
                                [
                                  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::Signature"
                                                      ],
                                                    [],
                                                    "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 signature := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_signature",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| signature |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::CommonSerializer",
                                  "signatures"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::CommonSerializer",
                                                  "signatures"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_signatures :
      M.IsAssociatedFunction Self "serialize_signatures" serialize_signatures.
    
    (*
        pub fn major_version(&self) -> u32 {
            self.major_version
        }
    *)
    Definition major_version (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (|
              M.read (| self |),
              "move_binary_format::serializer::CommonSerializer",
              "major_version"
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_major_version :
      M.IsAssociatedFunction Self "major_version" major_version.
  End Impl_move_binary_format_serializer_CommonSerializer.
  
  Module Impl_move_binary_format_serializer_ModuleSerializer.
    Definition Self : Ty.t := Ty.path "move_binary_format::serializer::ModuleSerializer".
    
    (*
        fn new(major_version: u32) -> ModuleSerializer {
            ModuleSerializer {
                common: CommonSerializer::new(major_version),
                struct_defs: (0, 0),
                struct_def_instantiations: (0, 0),
                function_defs: (0, 0),
                field_handles: (0, 0),
                field_instantiations: (0, 0),
                friend_decls: (0, 0),
            }
        }
    *)
    Definition new (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ major_version ] =>
        ltac:(M.monadic
          (let major_version := M.alloc (| major_version |) in
          Value.StructRecord
            "move_binary_format::serializer::ModuleSerializer"
            [
              ("common",
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "move_binary_format::serializer::CommonSerializer",
                    "new",
                    []
                  |),
                  [ M.read (| major_version |) ]
                |));
              ("struct_defs",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("struct_def_instantiations",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("function_defs",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("field_handles",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("field_instantiations",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ]);
              ("friend_decls",
                Value.Tuple [ Value.Integer IntegerKind.U32 0; Value.Integer IntegerKind.U32 0 ])
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new.
    
    (*
        fn serialize_tables(&mut self, binary: &mut BinaryData, module: &CompiledModule) -> Result<()> {
            self.common.serialize_common_tables(binary, module)?;
            self.serialize_struct_definitions(binary, &module.struct_defs)?;
            self.serialize_struct_def_instantiations(binary, &module.struct_def_instantiations)?;
            self.serialize_function_definitions(binary, &module.function_defs)?;
            self.serialize_field_handles(binary, &module.field_handles)?;
            self.serialize_field_instantiations(binary, &module.field_instantiations)?;
            self.serialize_friend_declarations(binary, &module.friend_decls)
        }
    *)
    Definition serialize_tables (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; module ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let module := M.alloc (| module |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_common_tables",
                              [ Ty.path "move_binary_format::file_format::CompiledModule" ]
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::ModuleSerializer",
                                "common"
                              |);
                              M.read (| binary |);
                              M.read (| 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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_struct_definitions",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              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::StructDefinition";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| module |),
                                    "move_binary_format::file_format::CompiledModule",
                                    "struct_defs"
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_struct_def_instantiations",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              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::StructDefInstantiation";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| module |),
                                    "move_binary_format::file_format::CompiledModule",
                                    "struct_def_instantiations"
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_function_definitions",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              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::FunctionDefinition";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| module |),
                                    "move_binary_format::file_format::CompiledModule",
                                    "function_defs"
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_field_handles",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              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::FieldHandle";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| module |),
                                    "move_binary_format::file_format::CompiledModule",
                                    "field_handles"
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::ModuleSerializer",
                              "serialize_field_instantiations",
                              []
                            |),
                            [
                              M.read (| self |);
                              M.read (| binary |);
                              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::FieldInstantiation";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| module |),
                                    "move_binary_format::file_format::CompiledModule",
                                    "field_instantiations"
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "move_binary_format::serializer::ModuleSerializer",
                      "serialize_friend_declarations",
                      []
                    |),
                    [
                      M.read (| self |);
                      M.read (| binary |);
                      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::ModuleHandle";
                              Ty.path "alloc::alloc::Global"
                            ],
                          [],
                          "deref",
                          []
                        |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| module |),
                            "move_binary_format::file_format::CompiledModule",
                            "friend_decls"
                          |)
                        ]
                      |)
                    ]
                  |)
                |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_tables :
      M.IsAssociatedFunction Self "serialize_tables" serialize_tables.
    
    (*
        fn serialize_table_indices(&mut self, binary: &mut BinaryData) -> Result<()> {
            self.common.serialize_table_indices(binary)?;
            serialize_table_index(
                binary,
                TableType::STRUCT_DEFS,
                self.struct_defs.0,
                self.struct_defs.1,
            )?;
            serialize_table_index(
                binary,
                TableType::STRUCT_DEF_INST,
                self.struct_def_instantiations.0,
                self.struct_def_instantiations.1,
            )?;
            serialize_table_index(
                binary,
                TableType::FUNCTION_DEFS,
                self.function_defs.0,
                self.function_defs.1,
            )?;
            serialize_table_index(
                binary,
                TableType::FIELD_HANDLE,
                self.field_handles.0,
                self.field_handles.1,
            )?;
            serialize_table_index(
                binary,
                TableType::FIELD_INST,
                self.field_instantiations.0,
                self.field_instantiations.1,
            )?;
            serialize_table_index(
                binary,
                TableType::FRIEND_DECLS,
                self.friend_decls.0,
                self.friend_decls.1,
            )?;
            Ok(())
        }
    *)
    Definition serialize_table_indices (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::serializer::CommonSerializer",
                              "serialize_table_indices",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "move_binary_format::serializer::ModuleSerializer",
                                "common"
                              |);
                              M.read (| binary |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::STRUCT_DEFS"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "struct_defs"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "struct_defs"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::STRUCT_DEF_INST"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "struct_def_instantiations"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "struct_def_instantiations"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::FUNCTION_DEFS"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "function_defs"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "function_defs"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::FIELD_HANDLE"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "field_handles"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "field_handles"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::FIELD_INST"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "field_instantiations"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "field_instantiations"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_table_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              Value.StructTuple
                                "move_binary_format::file_format_common::TableType::FRIEND_DECLS"
                                [];
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "friend_decls"
                                  |),
                                  0
                                |)
                              |);
                              M.read (|
                                M.SubPointer.get_tuple_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "move_binary_format::serializer::ModuleSerializer",
                                    "friend_decls"
                                  |),
                                  1
                                |)
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_table_indices :
      M.IsAssociatedFunction Self "serialize_table_indices" serialize_table_indices.
    
    (*
        fn serialize_struct_definitions(
            &mut self,
            binary: &mut BinaryData,
            struct_definitions: &[StructDefinition],
        ) -> Result<()> {
            if !struct_definitions.is_empty() {
                self.common.table_count = self.common.table_count.wrapping_add(1); // the count will bound to a small number
                self.struct_defs.0 = check_index_in_binary(binary.len())?;
                for struct_definition in struct_definitions {
                    serialize_struct_definition(binary, struct_definition)?;
                }
                self.struct_defs.1 = checked_calculate_table_size(binary, self.struct_defs.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_struct_definitions
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; struct_definitions ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let struct_definitions := M.alloc (| struct_definitions |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.path
                                            "move_binary_format::file_format::StructDefinition"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| struct_definitions |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_struct_record_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "common"
                                |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |),
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "u8", "wrapping_add", [] |),
                                [
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_binary_format::serializer::ModuleSerializer",
                                        "common"
                                      |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "table_count"
                                    |)
                                  |);
                                  Value.Integer IntegerKind.U8 1
                                ]
                              |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "struct_defs"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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.read (| struct_definitions |) ]
                                  |)
                                |),
                                [
                                  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_definition := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_struct_definition",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| struct_definition |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "struct_defs"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::ModuleSerializer",
                                                  "struct_defs"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_struct_definitions :
      M.IsAssociatedFunction Self "serialize_struct_definitions" serialize_struct_definitions.
    
    (*
        fn serialize_struct_def_instantiations(
            &mut self,
            binary: &mut BinaryData,
            struct_def_instantiations: &[StructDefInstantiation],
        ) -> Result<()> {
            if !struct_def_instantiations.is_empty() {
                self.common.table_count = self.common.table_count.wrapping_add(1); // the count will bound to a small number
                self.struct_def_instantiations.0 = check_index_in_binary(binary.len())?;
                for struct_instantiation in struct_def_instantiations {
                    serialize_struct_def_instantiation(binary, struct_instantiation)?;
                }
                self.struct_def_instantiations.1 =
                    checked_calculate_table_size(binary, self.struct_def_instantiations.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_struct_def_instantiations
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; struct_def_instantiations ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let struct_def_instantiations := M.alloc (| struct_def_instantiations |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.path
                                            "move_binary_format::file_format::StructDefInstantiation"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| struct_def_instantiations |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_struct_record_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "common"
                                |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |),
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "u8", "wrapping_add", [] |),
                                [
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_binary_format::serializer::ModuleSerializer",
                                        "common"
                                      |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "table_count"
                                    |)
                                  |);
                                  Value.Integer IntegerKind.U8 1
                                ]
                              |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "struct_def_instantiations"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::StructDefInstantiation"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| struct_def_instantiations |) ]
                                  |)
                                |),
                                [
                                  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::StructDefInstantiation"
                                                      ],
                                                    [],
                                                    "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_instantiation := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_struct_def_instantiation",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| struct_instantiation |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "struct_def_instantiations"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::ModuleSerializer",
                                                  "struct_def_instantiations"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_struct_def_instantiations :
      M.IsAssociatedFunction
        Self
        "serialize_struct_def_instantiations"
        serialize_struct_def_instantiations.
    
    (*
        fn serialize_field_handles(
            &mut self,
            binary: &mut BinaryData,
            field_handles: &[FieldHandle],
        ) -> Result<()> {
            if !field_handles.is_empty() {
                self.common.table_count += 1;
                self.field_handles.0 = check_index_in_binary(binary.len())?;
                for field_handle in field_handles {
                    serialize_field_handle(binary, field_handle)?;
                }
                self.field_handles.1 = checked_calculate_table_size(binary, self.field_handles.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_field_handles (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; binary; field_handles ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let field_handles := M.alloc (| field_handles |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::FieldHandle" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| field_handles |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "common"
                                |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "field_handles"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::FieldHandle"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| field_handles |) ]
                                  |)
                                |),
                                [
                                  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::FieldHandle"
                                                      ],
                                                    [],
                                                    "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 field_handle := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_field_handle",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| field_handle |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "field_handles"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::ModuleSerializer",
                                                  "field_handles"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_field_handles :
      M.IsAssociatedFunction Self "serialize_field_handles" serialize_field_handles.
    
    (*
        fn serialize_field_instantiations(
            &mut self,
            binary: &mut BinaryData,
            field_instantiations: &[FieldInstantiation],
        ) -> Result<()> {
            if !field_instantiations.is_empty() {
                self.common.table_count += 1;
                self.field_instantiations.0 = check_index_in_binary(binary.len())?;
                for field_instantiation in field_instantiations {
                    serialize_field_instantiation(binary, field_instantiation)?;
                }
                self.field_instantiations.1 =
                    checked_calculate_table_size(binary, self.field_instantiations.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_field_instantiations
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; field_instantiations ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let field_instantiations := M.alloc (| field_instantiations |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.path
                                            "move_binary_format::file_format::FieldInstantiation"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| field_instantiations |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "common"
                                |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "field_instantiations"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::FieldInstantiation"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| field_instantiations |) ]
                                  |)
                                |),
                                [
                                  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::FieldInstantiation"
                                                      ],
                                                    [],
                                                    "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 field_instantiation := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_field_instantiation",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| field_instantiation |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "field_instantiations"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::ModuleSerializer",
                                                  "field_instantiations"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_field_instantiations :
      M.IsAssociatedFunction Self "serialize_field_instantiations" serialize_field_instantiations.
    
    (*
        fn serialize_function_definitions(
            &mut self,
            binary: &mut BinaryData,
            function_definitions: &[FunctionDefinition],
        ) -> Result<()> {
            if !function_definitions.is_empty() {
                self.common.table_count = self.common.table_count.wrapping_add(1); // the count will bound to a small number
                self.function_defs.0 = check_index_in_binary(binary.len())?;
                for function_definition in function_definitions {
                    self.serialize_function_definition(binary, function_definition)?;
                }
                self.function_defs.1 = checked_calculate_table_size(binary, self.function_defs.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_function_definitions
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; function_definitions ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let function_definitions := M.alloc (| function_definitions |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.path
                                            "move_binary_format::file_format::FunctionDefinition"
                                        ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| function_definitions |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_struct_record_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "common"
                                |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |),
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "u8", "wrapping_add", [] |),
                                [
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_binary_format::serializer::ModuleSerializer",
                                        "common"
                                      |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "table_count"
                                    |)
                                  |);
                                  Value.Integer IntegerKind.U8 1
                                ]
                              |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "function_defs"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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 (| function_definitions |) ]
                                  |)
                                |),
                                [
                                  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_definition := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path
                                                                    "move_binary_format::serializer::ModuleSerializer",
                                                                  "serialize_function_definition",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| self |);
                                                                  M.read (| binary |);
                                                                  M.read (| function_definition |)
                                                                ]
                                                              |)
                                                            ]
                                                          |)
                                                        |),
                                                        [
                                                          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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "function_defs"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::ModuleSerializer",
                                                  "function_defs"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_function_definitions :
      M.IsAssociatedFunction Self "serialize_function_definitions" serialize_function_definitions.
    
    (*
        fn serialize_function_definition(
            &mut self,
            binary: &mut BinaryData,
            function_definition: &FunctionDefinition,
        ) -> Result<()> {
            serialize_function_handle_index(binary, &function_definition.function)?;
    
            let mut flags = 0;
            if self.common.major_version < VERSION_5 {
                let visibility = if function_definition.visibility == Visibility::Public
                    && function_definition.is_entry
                {
                    Visibility::DEPRECATED_SCRIPT
                } else {
                    function_definition.visibility as u8
                };
                binary.push(visibility)?;
            } else {
                binary.push(function_definition.visibility as u8)?;
                if function_definition.is_entry {
                    flags |= FunctionDefinition::ENTRY;
                }
            }
            if function_definition.is_native() {
                flags |= FunctionDefinition::NATIVE
            }
            binary.push(flags)?;
    
            serialize_acquires(binary, &function_definition.acquires_global_resources)?;
            if let Some(code) = &function_definition.code {
                serialize_code_unit(self.common.major_version(), binary, code)?;
            }
            Ok(())
        }
    *)
    Definition serialize_function_definition
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; function_definition ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let function_definition := M.alloc (| function_definition |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_function_handle_index",
                              []
                            |),
                            [
                              M.read (| binary |);
                              M.SubPointer.get_struct_record_field (|
                                M.read (| function_definition |),
                                "move_binary_format::file_format::FunctionDefinition",
                                "function"
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ flags := M.alloc (| Value.Integer IntegerKind.U8 0 |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.lt (|
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_binary_format::serializer::ModuleSerializer",
                                        "common"
                                      |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "major_version"
                                    |)
                                  |),
                                  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
                          let~ visibility :=
                            M.copy (|
                              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::Visibility",
                                                  [
                                                    Ty.path
                                                      "move_binary_format::file_format::Visibility"
                                                  ],
                                                  "eq",
                                                  []
                                                |),
                                                [
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| function_definition |),
                                                    "move_binary_format::file_format::FunctionDefinition",
                                                    "visibility"
                                                  |);
                                                  M.alloc (|
                                                    Value.StructTuple
                                                      "move_binary_format::file_format::Visibility::Public"
                                                      []
                                                  |)
                                                ]
                                              |),
                                              ltac:(M.monadic
                                                (M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| function_definition |),
                                                    "move_binary_format::file_format::FunctionDefinition",
                                                    "is_entry"
                                                  |)
                                                |)))
                                            |)
                                          |)) in
                                      let _ :=
                                        M.is_constant_or_break_match (|
                                          M.read (| γ |),
                                          Value.Bool true
                                        |) in
                                      M.get_constant (|
                                        "move_binary_format::file_format::DEPRECATED_SCRIPT"
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (M.alloc (|
                                        M.rust_cast
                                          (M.read (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| function_definition |),
                                              "move_binary_format::file_format::FunctionDefinition",
                                              "visibility"
                                            |)
                                          |))
                                      |)))
                                ]
                              |)
                            |) 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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [ M.read (| binary |); M.read (| visibility |) ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ =>
                        ltac:(M.monadic
                          (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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path
                                          "move_binary_format::file_format_common::BinaryData",
                                        "push",
                                        []
                                      |),
                                      [
                                        M.read (| binary |);
                                        M.rust_cast
                                          (M.read (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| function_definition |),
                                              "move_binary_format::file_format::FunctionDefinition",
                                              "visibility"
                                            |)
                                          |))
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.SubPointer.get_struct_record_field (|
                                        M.read (| function_definition |),
                                        "move_binary_format::file_format::FunctionDefinition",
                                        "is_entry"
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  let~ _ :=
                                    let β := flags in
                                    M.write (|
                                      β,
                                      BinOp.bit_or
                                        (M.read (| β |))
                                        (M.read (|
                                          M.get_constant (|
                                            "move_binary_format::file_format::ENTRY"
                                          |)
                                        |))
                                    |) in
                                  M.alloc (| Value.Tuple [] |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |)))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format::FunctionDefinition",
                                    "is_native",
                                    []
                                  |),
                                  [ M.read (| function_definition |) ]
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let β := flags in
                          M.write (|
                            β,
                            BinOp.bit_or
                              (M.read (| β |))
                              (M.read (|
                                M.get_constant (| "move_binary_format::file_format::NATIVE" |)
                              |))
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) 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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_binary_format::file_format_common::BinaryData",
                              "push",
                              []
                            |),
                            [ M.read (| binary |); M.read (| flags |) ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.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 "anyhow::Error" ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "move_binary_format::serializer::serialize_acquires",
                              []
                            |),
                            [
                              M.read (| binary |);
                              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::StructDefinitionIndex";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| function_definition |),
                                    "move_binary_format::file_format::FunctionDefinition",
                                    "acquires_global_resources"
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      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 "anyhow::Error" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "core::convert::Infallible";
                                            Ty.path "anyhow::Error"
                                          ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.alloc (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| function_definition |),
                                "move_binary_format::file_format::FunctionDefinition",
                                "code"
                              |)
                            |) in
                          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
                          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 "anyhow::Error" ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_binary_format::serializer::serialize_code_unit",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.path
                                              "move_binary_format::serializer::CommonSerializer",
                                            "major_version",
                                            []
                                          |),
                                          [
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| self |),
                                              "move_binary_format::serializer::ModuleSerializer",
                                              "common"
                                            |)
                                          ]
                                        |);
                                        M.read (| binary |);
                                        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 "anyhow::Error" ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path "anyhow::Error"
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_function_definition :
      M.IsAssociatedFunction Self "serialize_function_definition" serialize_function_definition.
    
    (*
        fn serialize_friend_declarations(
            &mut self,
            binary: &mut BinaryData,
            friend_declarations: &[ModuleHandle],
        ) -> Result<()> {
            if !friend_declarations.is_empty() {
                self.common.table_count = self.common.table_count.wrapping_add(1); // the count will bound to a small number
                self.friend_decls.0 = check_index_in_binary(binary.len())?;
                for module in friend_declarations {
                    serialize_module_handle(binary, module)?;
                }
                self.friend_decls.1 = checked_calculate_table_size(binary, self.friend_decls.0)?;
            }
            Ok(())
        }
    *)
    Definition serialize_friend_declarations
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; binary; friend_declarations ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let binary := M.alloc (| binary |) in
          let friend_declarations := M.alloc (| friend_declarations |) 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 (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [ Ty.path "move_binary_format::file_format::ModuleHandle" ],
                                      "is_empty",
                                      []
                                    |),
                                    [ M.read (| friend_declarations |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_struct_record_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "common"
                                |),
                                "move_binary_format::serializer::CommonSerializer",
                                "table_count"
                              |),
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "u8", "wrapping_add", [] |),
                                [
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_binary_format::serializer::ModuleSerializer",
                                        "common"
                                      |),
                                      "move_binary_format::serializer::CommonSerializer",
                                      "table_count"
                                    |)
                                  |);
                                  Value.Integer IntegerKind.U8 1
                                ]
                              |)
                            |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "friend_decls"
                                |),
                                0
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::check_index_in_binary",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format_common::BinaryData",
                                                "len",
                                                []
                                              |),
                                              [ M.read (| binary |) ]
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          let~ _ :=
                            M.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::ModuleHandle"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| friend_declarations |) ]
                                  |)
                                |),
                                [
                                  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::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 module := M.copy (| γ0_0 |) 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 "anyhow::Error"
                                                                ],
                                                              [],
                                                              "branch",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_binary_format::serializer::serialize_module_handle",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| binary |);
                                                                  M.read (| 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
                                                                                "anyhow::Error"
                                                                            ],
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "core::convert::Infallible";
                                                                                Ty.path
                                                                                  "anyhow::Error"
                                                                              ]
                                                                          ],
                                                                          "from_residual",
                                                                          []
                                                                        |),
                                                                        [ M.read (| residual |) ]
                                                                      |)
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                                  0
                                                                |) in
                                                              let val := M.copy (| γ0_0 |) in
                                                              val))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_tuple_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_binary_format::serializer::ModuleSerializer",
                                  "friend_decls"
                                |),
                                1
                              |),
                              M.read (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "u32"; Ty.path "anyhow::Error" ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_binary_format::serializer::checked_calculate_table_size",
                                            []
                                          |),
                                          [
                                            M.read (| binary |);
                                            M.read (|
                                              M.SubPointer.get_tuple_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "move_binary_format::serializer::ModuleSerializer",
                                                  "friend_decls"
                                                |),
                                                0
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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 "anyhow::Error" ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path "anyhow::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_serialize_friend_declarations :
      M.IsAssociatedFunction Self "serialize_friend_declarations" serialize_friend_declarations.
  End Impl_move_binary_format_serializer_ModuleSerializer.
End serializer.
