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

Module state.
  (* Trait *)
  (* Empty module 'PackedSizeOf' *)
  
  (* StructRecord
    {
      name := "Mint";
      ty_params := [];
      fields :=
        [
          ("mint_authority",
            Ty.apply
              (Ty.path "solana_program::program_option::COption")
              [ Ty.path "solana_program::pubkey::Pubkey" ]);
          ("supply", Ty.path "u64");
          ("decimals", Ty.path "u8");
          ("is_initialized", Ty.path "bool");
          ("freeze_authority",
            Ty.apply
              (Ty.path "solana_program::program_option::COption")
              [ Ty.path "solana_program::pubkey::Pubkey" ])
        ];
    } *)
  
  Module Impl_core_clone_Clone_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (* Clone *)
    Definition clone (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.match_operator (|
              Value.DeclaredButUndefined,
              [
                fun γ =>
                  ltac:(M.monadic
                    (M.match_operator (|
                      Value.DeclaredButUndefined,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (M.match_operator (|
                              Value.DeclaredButUndefined,
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.match_operator (|
                                      Value.DeclaredButUndefined,
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (M.match_operator (|
                                              Value.DeclaredButUndefined,
                                              [ fun γ => ltac:(M.monadic (M.read (| self |))) ]
                                            |)))
                                      ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("clone", InstanceField.Method clone) ].
  End Impl_core_clone_Clone_for_spl_token_2022_state_Mint.
  
  Module Impl_core_marker_Copy_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Copy"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Copy_for_spl_token_2022_state_Mint.
  
  Module Impl_core_fmt_Debug_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (* Debug *)
    Definition fmt (τ : 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.call_closure (|
            M.get_associated_function (|
              Ty.path "core::fmt::Formatter",
              "debug_struct_field5_finish",
              []
            |),
            [
              M.read (| f |);
              M.read (| Value.String "Mint" |);
              M.read (| Value.String "mint_authority" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Mint",
                  "mint_authority"
                |));
              M.read (| Value.String "supply" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Mint",
                  "supply"
                |));
              M.read (| Value.String "decimals" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Mint",
                  "decimals"
                |));
              M.read (| Value.String "is_initialized" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Mint",
                  "is_initialized"
                |));
              M.read (| Value.String "freeze_authority" |);
              (* Unsize *)
              M.pointer_coercion
                (M.alloc (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "spl_token_2022::state::Mint",
                    "freeze_authority"
                  |)
                |))
            ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_spl_token_2022_state_Mint.
  
  Module Impl_core_default_Default_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (* Default *)
    Definition default (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [] =>
        ltac:(M.monadic
          (Value.StructRecord
            "spl_token_2022::state::Mint"
            [
              ("mint_authority",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.apply
                      (Ty.path "solana_program::program_option::COption")
                      [ Ty.path "solana_program::pubkey::Pubkey" ],
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("supply",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "u64",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("decimals",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "u8",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("is_initialized",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "bool",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("freeze_authority",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.apply
                      (Ty.path "solana_program::program_option::COption")
                      [ Ty.path "solana_program::pubkey::Pubkey" ],
                    [],
                    "default",
                    []
                  |),
                  []
                |))
            ]))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::default::Default"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("default", InstanceField.Method default) ].
  End Impl_core_default_Default_for_spl_token_2022_state_Mint.
  
  Module Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::StructuralPartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_Mint.
  
  Module Impl_core_cmp_PartialEq_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (* PartialEq *)
    Definition eq (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          LogicalOp.and (|
            LogicalOp.and (|
              LogicalOp.and (|
                LogicalOp.and (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::cmp::PartialEq",
                      Ty.apply
                        (Ty.path "solana_program::program_option::COption")
                        [ Ty.path "solana_program::pubkey::Pubkey" ],
                      [
                        Ty.apply
                          (Ty.path "solana_program::program_option::COption")
                          [ Ty.path "solana_program::pubkey::Pubkey" ]
                      ],
                      "eq",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "spl_token_2022::state::Mint",
                        "mint_authority"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| other |),
                        "spl_token_2022::state::Mint",
                        "mint_authority"
                      |)
                    ]
                  |),
                  ltac:(M.monadic
                    (BinOp.Pure.eq
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "spl_token_2022::state::Mint",
                          "supply"
                        |)
                      |))
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| other |),
                          "spl_token_2022::state::Mint",
                          "supply"
                        |)
                      |))))
                |),
                ltac:(M.monadic
                  (BinOp.Pure.eq
                    (M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "spl_token_2022::state::Mint",
                        "decimals"
                      |)
                    |))
                    (M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| other |),
                        "spl_token_2022::state::Mint",
                        "decimals"
                      |)
                    |))))
              |),
              ltac:(M.monadic
                (BinOp.Pure.eq
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "spl_token_2022::state::Mint",
                      "is_initialized"
                    |)
                  |))
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| other |),
                      "spl_token_2022::state::Mint",
                      "is_initialized"
                    |)
                  |))))
            |),
            ltac:(M.monadic
              (M.call_closure (|
                M.get_trait_method (|
                  "core::cmp::PartialEq",
                  Ty.apply
                    (Ty.path "solana_program::program_option::COption")
                    [ Ty.path "solana_program::pubkey::Pubkey" ],
                  [
                    Ty.apply
                      (Ty.path "solana_program::program_option::COption")
                      [ Ty.path "solana_program::pubkey::Pubkey" ]
                  ],
                  "eq",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "spl_token_2022::state::Mint",
                    "freeze_authority"
                  |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| other |),
                    "spl_token_2022::state::Mint",
                    "freeze_authority"
                  |)
                ]
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("eq", InstanceField.Method eq) ].
  End Impl_core_cmp_PartialEq_for_spl_token_2022_state_Mint.
  
  Module Impl_solana_program_program_pack_Sealed_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::Sealed"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_solana_program_program_pack_Sealed_for_spl_token_2022_state_Mint.
  
  Module Impl_solana_program_program_pack_IsInitialized_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (*
        fn is_initialized(&self) -> bool {
            self.is_initialized
        }
    *)
    Definition is_initialized (τ : 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 |),
              "spl_token_2022::state::Mint",
              "is_initialized"
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::IsInitialized"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("is_initialized", InstanceField.Method is_initialized) ].
  End Impl_solana_program_program_pack_IsInitialized_for_spl_token_2022_state_Mint.
  
  Module Impl_solana_program_program_pack_Pack_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (*     const LEN: usize = 82; *)
    (* Ty.path "usize" *)
    Definition value_LEN : Value.t := M.run ltac:(M.monadic (M.alloc (| Value.Integer 82 |))).
    
    (*
        fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
            let src = array_ref![src, 0, 82];
            let (mint_authority, supply, decimals, is_initialized, freeze_authority) =
                array_refs![src, 36, 8, 1, 1, 36];
            let mint_authority = unpack_coption_key(mint_authority)?;
            let supply = u64::from_le_bytes( *supply);
            let decimals = decimals[0];
            let is_initialized = match is_initialized {
                [0] => false,
                [1] => true,
                _ => return Err(ProgramError::InvalidAccountData),
            };
            let freeze_authority = unpack_coption_key(freeze_authority)?;
            Ok(Mint {
                mint_authority,
                supply,
                decimals,
                is_initialized,
                freeze_authority,
            })
        }
    *)
    Definition unpack_from_slice (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ src ] =>
        ltac:(M.monadic
          (let src := M.alloc (| src |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let src :=
                  M.copy (|
                    let offset := M.alloc (| Value.Integer 0 |) in
                    let slice :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::index::Index",
                            Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                            [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ],
                            "index",
                            []
                          |),
                          [
                            M.read (| src |);
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", M.read (| offset |));
                                ("end_",
                                  BinOp.Panic.add (|
                                    Integer.Usize,
                                    M.read (| offset |),
                                    Value.Integer 82
                                  |))
                              ]
                          ]
                        |)
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (| Self, "as_array.unpack_from_slice", [] |),
                        [ M.read (| slice |) ]
                      |)
                    |)
                  |) in
                M.match_operator (|
                  let input := M.copy (| src |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Self, "as_arrays.unpack_from_slice", [] |),
                      [ M.read (| input |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                        let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                        let γ0_2 := M.SubPointer.get_tuple_field (| γ, 2 |) in
                        let γ0_3 := M.SubPointer.get_tuple_field (| γ, 3 |) in
                        let γ0_4 := M.SubPointer.get_tuple_field (| γ, 4 |) in
                        let mint_authority := M.copy (| γ0_0 |) in
                        let supply := M.copy (| γ0_1 |) in
                        let decimals := M.copy (| γ0_2 |) in
                        let is_initialized := M.copy (| γ0_3 |) in
                        let freeze_authority := M.copy (| γ0_4 |) in
                        let mint_authority :=
                          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.apply
                                          (Ty.path "solana_program::program_option::COption")
                                          [ Ty.path "solana_program::pubkey::Pubkey" ];
                                        Ty.path "solana_program::program_error::ProgramError"
                                      ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "spl_token_2022::state::unpack_coption_key",
                                        []
                                      |),
                                      [ M.read (| mint_authority |) ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "spl_token_2022::state::Mint";
                                                    Ty.path
                                                      "solana_program::program_error::ProgramError"
                                                  ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path
                                                        "solana_program::program_error::ProgramError"
                                                    ]
                                                ],
                                                "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 supply :=
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u64", "from_le_bytes", [] |),
                              [ M.read (| M.read (| supply |) |) ]
                            |)
                          |) in
                        let decimals :=
                          M.copy (|
                            M.SubPointer.get_array_field (|
                              M.read (| decimals |),
                              M.alloc (| Value.Integer 0 |)
                            |)
                          |) in
                        let is_initialized :=
                          M.copy (|
                            M.match_operator (|
                              is_initialized,
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ := M.read (| γ |) in
                                    let γ1_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ1_0 |),
                                        Value.Integer 0
                                      |) in
                                    M.alloc (| Value.Bool false |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ := M.read (| γ |) in
                                    let γ1_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ1_0 |),
                                        Value.Integer 1
                                      |) in
                                    M.alloc (| Value.Bool true |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.alloc (|
                                      M.never_to_any (|
                                        M.read (|
                                          M.return_ (|
                                            Value.StructTuple
                                              "core::result::Result::Err"
                                              [
                                                Value.StructTuple
                                                  "solana_program::program_error::ProgramError::InvalidAccountData"
                                                  []
                                              ]
                                          |)
                                        |)
                                      |)
                                    |)))
                              ]
                            |)
                          |) in
                        let freeze_authority :=
                          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.apply
                                          (Ty.path "solana_program::program_option::COption")
                                          [ Ty.path "solana_program::pubkey::Pubkey" ];
                                        Ty.path "solana_program::program_error::ProgramError"
                                      ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "spl_token_2022::state::unpack_coption_key",
                                        []
                                      |),
                                      [ M.read (| freeze_authority |) ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                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 "spl_token_2022::state::Mint";
                                                    Ty.path
                                                      "solana_program::program_error::ProgramError"
                                                  ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.path
                                                        "solana_program::program_error::ProgramError"
                                                    ]
                                                ],
                                                "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.StructRecord
                                "spl_token_2022::state::Mint"
                                [
                                  ("mint_authority", M.read (| mint_authority |));
                                  ("supply", M.read (| supply |));
                                  ("decimals", M.read (| decimals |));
                                  ("is_initialized", M.read (| is_initialized |));
                                  ("freeze_authority", M.read (| freeze_authority |))
                                ]
                            ]
                        |)))
                  ]
                |)
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    (*
        fn pack_into_slice(&self, dst: &mut [u8]) {
            let dst = array_mut_ref![dst, 0, 82];
            let (
                mint_authority_dst,
                supply_dst,
                decimals_dst,
                is_initialized_dst,
                freeze_authority_dst,
            ) = mut_array_refs![dst, 36, 8, 1, 1, 36];
            let &Mint {
                ref mint_authority,
                supply,
                decimals,
                is_initialized,
                ref freeze_authority,
            } = self;
            pack_coption_key(mint_authority, mint_authority_dst);
            *supply_dst = supply.to_le_bytes();
            decimals_dst[0] = decimals;
            is_initialized_dst[0] = is_initialized as u8;
            pack_coption_key(freeze_authority, freeze_authority_dst);
        }
    *)
    Definition pack_into_slice (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; dst ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let dst := M.alloc (| dst |) in
          M.read (|
            let dst :=
              M.alloc (|
                M.read (|
                  let offset := M.alloc (| Value.Integer 0 |) in
                  let slice :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::index::IndexMut",
                          Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                          [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          M.read (| dst |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [
                              ("start", M.read (| offset |));
                              ("end_",
                                BinOp.Panic.add (|
                                  Integer.Usize,
                                  M.read (| offset |),
                                  Value.Integer 82
                                |))
                            ]
                        ]
                      |)
                    |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Self, "as_array.pack_into_slice", [] |),
                      [ M.read (| slice |) ]
                    |)
                  |)
                |)
              |) in
            M.match_operator (|
              let input := M.copy (| dst |) in
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Self, "as_arrays.pack_into_slice", [] |),
                  [ M.read (| input |) ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                    let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                    let γ0_2 := M.SubPointer.get_tuple_field (| γ, 2 |) in
                    let γ0_3 := M.SubPointer.get_tuple_field (| γ, 3 |) in
                    let γ0_4 := M.SubPointer.get_tuple_field (| γ, 4 |) in
                    let mint_authority_dst := M.copy (| γ0_0 |) in
                    let supply_dst := M.copy (| γ0_1 |) in
                    let decimals_dst := M.copy (| γ0_2 |) in
                    let is_initialized_dst := M.copy (| γ0_3 |) in
                    let freeze_authority_dst := M.copy (| γ0_4 |) in
                    M.match_operator (|
                      self,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ := M.read (| γ |) in
                            let γ1_0 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Mint",
                                "mint_authority"
                              |) in
                            let γ1_1 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Mint",
                                "supply"
                              |) in
                            let γ1_2 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Mint",
                                "decimals"
                              |) in
                            let γ1_3 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Mint",
                                "is_initialized"
                              |) in
                            let γ1_4 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Mint",
                                "freeze_authority"
                              |) in
                            let mint_authority := M.alloc (| γ1_0 |) in
                            let supply := M.copy (| γ1_1 |) in
                            let decimals := M.copy (| γ1_2 |) in
                            let is_initialized := M.copy (| γ1_3 |) in
                            let freeze_authority := M.alloc (| γ1_4 |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "spl_token_2022::state::pack_coption_key",
                                    []
                                  |),
                                  [ M.read (| mint_authority |); M.read (| mint_authority_dst |) ]
                                |)
                              |) in
                            let _ :=
                              M.write (|
                                M.read (| supply_dst |),
                                M.call_closure (|
                                  M.get_associated_function (| Ty.path "u64", "to_le_bytes", [] |),
                                  [ M.read (| supply |) ]
                                |)
                              |) in
                            let _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| decimals_dst |),
                                  M.alloc (| Value.Integer 0 |)
                                |),
                                M.read (| decimals |)
                              |) in
                            let _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| is_initialized_dst |),
                                  M.alloc (| Value.Integer 0 |)
                                |),
                                M.rust_cast (M.read (| is_initialized |))
                              |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "spl_token_2022::state::pack_coption_key",
                                    []
                                  |),
                                  [ M.read (| freeze_authority |); M.read (| freeze_authority_dst |)
                                  ]
                                |)
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::Pack"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("value_LEN", InstanceField.Constant value_LEN);
          ("unpack_from_slice", InstanceField.Method unpack_from_slice);
          ("pack_into_slice", InstanceField.Method pack_into_slice)
        ].
  End Impl_solana_program_program_pack_Pack_for_spl_token_2022_state_Mint.
  
  Module Impl_spl_token_2022_state_PackedSizeOf_for_spl_token_2022_state_Mint.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Mint".
    
    (*     const SIZE_OF: usize = Self::LEN; *)
    (* Ty.path "usize" *)
    Definition value_SIZE_OF : Value.t :=
      M.run ltac:(M.monadic (M.get_constant (| "solana_program::program_pack::Pack::LEN" |))).
    
    Axiom Implements :
      M.IsTraitInstance
        "spl_token_2022::state::PackedSizeOf"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("value_SIZE_OF", InstanceField.Constant value_SIZE_OF) ].
  End Impl_spl_token_2022_state_PackedSizeOf_for_spl_token_2022_state_Mint.
  
  (* StructRecord
    {
      name := "Account";
      ty_params := [];
      fields :=
        [
          ("mint", Ty.path "solana_program::pubkey::Pubkey");
          ("owner", Ty.path "solana_program::pubkey::Pubkey");
          ("amount", Ty.path "u64");
          ("delegate",
            Ty.apply
              (Ty.path "solana_program::program_option::COption")
              [ Ty.path "solana_program::pubkey::Pubkey" ]);
          ("state", Ty.path "spl_token_2022::state::AccountState");
          ("is_native",
            Ty.apply (Ty.path "solana_program::program_option::COption") [ Ty.path "u64" ]);
          ("delegated_amount", Ty.path "u64");
          ("close_authority",
            Ty.apply
              (Ty.path "solana_program::program_option::COption")
              [ Ty.path "solana_program::pubkey::Pubkey" ])
        ];
    } *)
  
  Module Impl_core_clone_Clone_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (* Clone *)
    Definition clone (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.match_operator (|
              Value.DeclaredButUndefined,
              [
                fun γ =>
                  ltac:(M.monadic
                    (M.match_operator (|
                      Value.DeclaredButUndefined,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (M.match_operator (|
                              Value.DeclaredButUndefined,
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.match_operator (|
                                      Value.DeclaredButUndefined,
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (M.match_operator (|
                                              Value.DeclaredButUndefined,
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (M.match_operator (|
                                                      Value.DeclaredButUndefined,
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic (M.read (| self |)))
                                                      ]
                                                    |)))
                                              ]
                                            |)))
                                      ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("clone", InstanceField.Method clone) ].
  End Impl_core_clone_Clone_for_spl_token_2022_state_Account.
  
  Module Impl_core_marker_Copy_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Copy"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Copy_for_spl_token_2022_state_Account.
  
  Module Impl_core_fmt_Debug_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (* Debug *)
    Definition fmt (τ : 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 "mint" |);
                      M.read (| Value.String "owner" |);
                      M.read (| Value.String "amount" |);
                      M.read (| Value.String "delegate" |);
                      M.read (| Value.String "state" |);
                      M.read (| Value.String "is_native" |);
                      M.read (| Value.String "delegated_amount" |);
                      M.read (| Value.String "close_authority" |)
                    ]
                |)
              |) in
            let values :=
              M.alloc (|
                (* Unsize *)
                M.pointer_coercion
                  (M.alloc (|
                    Value.Array
                      [
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "mint"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "owner"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "amount"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "delegate"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "state"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "is_native"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "delegated_amount"
                          |));
                        (* Unsize *)
                        M.pointer_coercion
                          (M.alloc (|
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "spl_token_2022::state::Account",
                              "close_authority"
                            |)
                          |))
                      ]
                  |))
              |) 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 "Account" |);
                  (* Unsize *) M.pointer_coercion (M.read (| names |));
                  M.read (| values |)
                ]
              |)
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_spl_token_2022_state_Account.
  
  Module Impl_core_default_Default_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (* Default *)
    Definition default (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [] =>
        ltac:(M.monadic
          (Value.StructRecord
            "spl_token_2022::state::Account"
            [
              ("mint",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "solana_program::pubkey::Pubkey",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("owner",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "solana_program::pubkey::Pubkey",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("amount",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "u64",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("delegate",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.apply
                      (Ty.path "solana_program::program_option::COption")
                      [ Ty.path "solana_program::pubkey::Pubkey" ],
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("state",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "spl_token_2022::state::AccountState",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("is_native",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.apply (Ty.path "solana_program::program_option::COption") [ Ty.path "u64" ],
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("delegated_amount",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "u64",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("close_authority",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.apply
                      (Ty.path "solana_program::program_option::COption")
                      [ Ty.path "solana_program::pubkey::Pubkey" ],
                    [],
                    "default",
                    []
                  |),
                  []
                |))
            ]))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::default::Default"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("default", InstanceField.Method default) ].
  End Impl_core_default_Default_for_spl_token_2022_state_Account.
  
  Module Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::StructuralPartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_Account.
  
  Module Impl_core_cmp_PartialEq_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (* PartialEq *)
    Definition eq (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          LogicalOp.and (|
            LogicalOp.and (|
              LogicalOp.and (|
                LogicalOp.and (|
                  LogicalOp.and (|
                    LogicalOp.and (|
                      LogicalOp.and (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::cmp::PartialEq",
                            Ty.path "solana_program::pubkey::Pubkey",
                            [ Ty.path "solana_program::pubkey::Pubkey" ],
                            "eq",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "spl_token_2022::state::Account",
                              "mint"
                            |);
                            M.SubPointer.get_struct_record_field (|
                              M.read (| other |),
                              "spl_token_2022::state::Account",
                              "mint"
                            |)
                          ]
                        |),
                        ltac:(M.monadic
                          (M.call_closure (|
                            M.get_trait_method (|
                              "core::cmp::PartialEq",
                              Ty.path "solana_program::pubkey::Pubkey",
                              [ Ty.path "solana_program::pubkey::Pubkey" ],
                              "eq",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "spl_token_2022::state::Account",
                                "owner"
                              |);
                              M.SubPointer.get_struct_record_field (|
                                M.read (| other |),
                                "spl_token_2022::state::Account",
                                "owner"
                              |)
                            ]
                          |)))
                      |),
                      ltac:(M.monadic
                        (BinOp.Pure.eq
                          (M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "spl_token_2022::state::Account",
                              "amount"
                            |)
                          |))
                          (M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.read (| other |),
                              "spl_token_2022::state::Account",
                              "amount"
                            |)
                          |))))
                    |),
                    ltac:(M.monadic
                      (M.call_closure (|
                        M.get_trait_method (|
                          "core::cmp::PartialEq",
                          Ty.apply
                            (Ty.path "solana_program::program_option::COption")
                            [ Ty.path "solana_program::pubkey::Pubkey" ],
                          [
                            Ty.apply
                              (Ty.path "solana_program::program_option::COption")
                              [ Ty.path "solana_program::pubkey::Pubkey" ]
                          ],
                          "eq",
                          []
                        |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "spl_token_2022::state::Account",
                            "delegate"
                          |);
                          M.SubPointer.get_struct_record_field (|
                            M.read (| other |),
                            "spl_token_2022::state::Account",
                            "delegate"
                          |)
                        ]
                      |)))
                  |),
                  ltac:(M.monadic
                    (M.call_closure (|
                      M.get_trait_method (|
                        "core::cmp::PartialEq",
                        Ty.path "spl_token_2022::state::AccountState",
                        [ Ty.path "spl_token_2022::state::AccountState" ],
                        "eq",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "spl_token_2022::state::Account",
                          "state"
                        |);
                        M.SubPointer.get_struct_record_field (|
                          M.read (| other |),
                          "spl_token_2022::state::Account",
                          "state"
                        |)
                      ]
                    |)))
                |),
                ltac:(M.monadic
                  (M.call_closure (|
                    M.get_trait_method (|
                      "core::cmp::PartialEq",
                      Ty.apply
                        (Ty.path "solana_program::program_option::COption")
                        [ Ty.path "u64" ],
                      [
                        Ty.apply
                          (Ty.path "solana_program::program_option::COption")
                          [ Ty.path "u64" ]
                      ],
                      "eq",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "spl_token_2022::state::Account",
                        "is_native"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| other |),
                        "spl_token_2022::state::Account",
                        "is_native"
                      |)
                    ]
                  |)))
              |),
              ltac:(M.monadic
                (BinOp.Pure.eq
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "spl_token_2022::state::Account",
                      "delegated_amount"
                    |)
                  |))
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| other |),
                      "spl_token_2022::state::Account",
                      "delegated_amount"
                    |)
                  |))))
            |),
            ltac:(M.monadic
              (M.call_closure (|
                M.get_trait_method (|
                  "core::cmp::PartialEq",
                  Ty.apply
                    (Ty.path "solana_program::program_option::COption")
                    [ Ty.path "solana_program::pubkey::Pubkey" ],
                  [
                    Ty.apply
                      (Ty.path "solana_program::program_option::COption")
                      [ Ty.path "solana_program::pubkey::Pubkey" ]
                  ],
                  "eq",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "spl_token_2022::state::Account",
                    "close_authority"
                  |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| other |),
                    "spl_token_2022::state::Account",
                    "close_authority"
                  |)
                ]
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("eq", InstanceField.Method eq) ].
  End Impl_core_cmp_PartialEq_for_spl_token_2022_state_Account.
  
  Module Impl_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (*
        pub fn is_frozen(&self) -> bool {
            self.state == AccountState::Frozen
        }
    *)
    Definition is_frozen (τ : 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::cmp::PartialEq",
              Ty.path "spl_token_2022::state::AccountState",
              [ Ty.path "spl_token_2022::state::AccountState" ],
              "eq",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "spl_token_2022::state::Account",
                "state"
              |);
              M.alloc (| Value.StructTuple "spl_token_2022::state::AccountState::Frozen" [] |)
            ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom AssociatedFunction_is_frozen : M.IsAssociatedFunction Self "is_frozen" is_frozen.
    
    (*
        pub fn is_native(&self) -> bool {
            self.is_native.is_some()
        }
    *)
    Definition is_native (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply (Ty.path "solana_program::program_option::COption") [ Ty.path "u64" ],
              "is_some",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "spl_token_2022::state::Account",
                "is_native"
              |)
            ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom AssociatedFunction_is_native : M.IsAssociatedFunction Self "is_native" is_native.
    
    (*
        pub fn is_owned_by_system_program_or_incinerator(&self) -> bool {
            solana_program::system_program::check_id(&self.owner)
                || solana_program::incinerator::check_id(&self.owner)
        }
    *)
    Definition is_owned_by_system_program_or_incinerator (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          LogicalOp.or (|
            M.call_closure (|
              M.get_function (| "solana_program::system_program::check_id", [] |),
              [
                M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Account",
                  "owner"
                |)
              ]
            |),
            ltac:(M.monadic
              (M.call_closure (|
                M.get_function (| "solana_program::incinerator::check_id", [] |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "spl_token_2022::state::Account",
                    "owner"
                  |)
                ]
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom AssociatedFunction_is_owned_by_system_program_or_incinerator :
      M.IsAssociatedFunction
        Self
        "is_owned_by_system_program_or_incinerator"
        is_owned_by_system_program_or_incinerator.
  End Impl_spl_token_2022_state_Account.
  
  Module Impl_solana_program_program_pack_Sealed_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::Sealed"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_solana_program_program_pack_Sealed_for_spl_token_2022_state_Account.
  
  Module Impl_solana_program_program_pack_IsInitialized_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (*
        fn is_initialized(&self) -> bool {
            self.state != AccountState::Uninitialized
        }
    *)
    Definition is_initialized (τ : 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::cmp::PartialEq",
              Ty.path "spl_token_2022::state::AccountState",
              [ Ty.path "spl_token_2022::state::AccountState" ],
              "ne",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "spl_token_2022::state::Account",
                "state"
              |);
              M.alloc (|
                Value.StructTuple "spl_token_2022::state::AccountState::Uninitialized" []
              |)
            ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::IsInitialized"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("is_initialized", InstanceField.Method is_initialized) ].
  End Impl_solana_program_program_pack_IsInitialized_for_spl_token_2022_state_Account.
  
  Module Impl_solana_program_program_pack_Pack_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (*     const LEN: usize = 165; *)
    (* Ty.path "usize" *)
    Definition value_LEN : Value.t := M.run ltac:(M.monadic (M.alloc (| Value.Integer 165 |))).
    
    (*
        fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
            let src = array_ref![src, 0, 165];
            let (mint, owner, amount, delegate, state, is_native, delegated_amount, close_authority) =
                array_refs![src, 32, 32, 8, 36, 1, 12, 8, 36];
            Ok(Account {
                mint: Pubkey::new_from_array( *mint),
                owner: Pubkey::new_from_array( *owner),
                amount: u64::from_le_bytes( *amount),
                delegate: unpack_coption_key(delegate)?,
                state: AccountState::try_from_primitive(state[0])
                    .or(Err(ProgramError::InvalidAccountData))?,
                is_native: unpack_coption_u64(is_native)?,
                delegated_amount: u64::from_le_bytes( *delegated_amount),
                close_authority: unpack_coption_key(close_authority)?,
            })
        }
    *)
    Definition unpack_from_slice (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ src ] =>
        ltac:(M.monadic
          (let src := M.alloc (| src |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let src :=
                  M.copy (|
                    let offset := M.alloc (| Value.Integer 0 |) in
                    let slice :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::index::Index",
                            Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                            [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ],
                            "index",
                            []
                          |),
                          [
                            M.read (| src |);
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", M.read (| offset |));
                                ("end_",
                                  BinOp.Panic.add (|
                                    Integer.Usize,
                                    M.read (| offset |),
                                    Value.Integer 165
                                  |))
                              ]
                          ]
                        |)
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (| Self, "as_array.unpack_from_slice", [] |),
                        [ M.read (| slice |) ]
                      |)
                    |)
                  |) in
                M.match_operator (|
                  let input := M.copy (| src |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Self, "as_arrays.unpack_from_slice", [] |),
                      [ M.read (| input |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                        let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                        let γ0_2 := M.SubPointer.get_tuple_field (| γ, 2 |) in
                        let γ0_3 := M.SubPointer.get_tuple_field (| γ, 3 |) in
                        let γ0_4 := M.SubPointer.get_tuple_field (| γ, 4 |) in
                        let γ0_5 := M.SubPointer.get_tuple_field (| γ, 5 |) in
                        let γ0_6 := M.SubPointer.get_tuple_field (| γ, 6 |) in
                        let γ0_7 := M.SubPointer.get_tuple_field (| γ, 7 |) in
                        let mint := M.copy (| γ0_0 |) in
                        let owner := M.copy (| γ0_1 |) in
                        let amount := M.copy (| γ0_2 |) in
                        let delegate := M.copy (| γ0_3 |) in
                        let state := M.copy (| γ0_4 |) in
                        let is_native := M.copy (| γ0_5 |) in
                        let delegated_amount := M.copy (| γ0_6 |) in
                        let close_authority := M.copy (| γ0_7 |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::result::Result::Ok"
                            [
                              Value.StructRecord
                                "spl_token_2022::state::Account"
                                [
                                  ("mint",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "solana_program::pubkey::Pubkey",
                                        "new_from_array",
                                        []
                                      |),
                                      [ M.read (| M.read (| mint |) |) ]
                                    |));
                                  ("owner",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "solana_program::pubkey::Pubkey",
                                        "new_from_array",
                                        []
                                      |),
                                      [ M.read (| M.read (| owner |) |) ]
                                    |));
                                  ("amount",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "u64",
                                        "from_le_bytes",
                                        []
                                      |),
                                      [ M.read (| M.read (| amount |) |) ]
                                    |));
                                  ("delegate",
                                    M.read (|
                                      M.match_operator (|
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::Try",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                [
                                                  Ty.apply
                                                    (Ty.path
                                                      "solana_program::program_option::COption")
                                                    [ Ty.path "solana_program::pubkey::Pubkey" ];
                                                  Ty.path
                                                    "solana_program::program_error::ProgramError"
                                                ],
                                              [],
                                              "branch",
                                              []
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_function (|
                                                  "spl_token_2022::state::unpack_coption_key",
                                                  []
                                                |),
                                                [ M.read (| delegate |) ]
                                              |)
                                            ]
                                          |)
                                        |),
                                        [
                                          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
                                                                "spl_token_2022::state::Account";
                                                              Ty.path
                                                                "solana_program::program_error::ProgramError"
                                                            ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              [
                                                                Ty.path "core::convert::Infallible";
                                                                Ty.path
                                                                  "solana_program::program_error::ProgramError"
                                                              ]
                                                          ],
                                                          "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))
                                        ]
                                      |)
                                    |));
                                  ("state",
                                    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 "spl_token_2022::state::AccountState";
                                                  Ty.path
                                                    "solana_program::program_error::ProgramError"
                                                ],
                                              [],
                                              "branch",
                                              []
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    [
                                                      Ty.path "spl_token_2022::state::AccountState";
                                                      Ty.apply
                                                        (Ty.path "num_enum::TryFromPrimitiveError")
                                                        [
                                                          Ty.path
                                                            "spl_token_2022::state::AccountState"
                                                        ]
                                                    ],
                                                  "or",
                                                  [
                                                    Ty.path
                                                      "solana_program::program_error::ProgramError"
                                                  ]
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "num_enum::TryFromPrimitive",
                                                      Ty.path "spl_token_2022::state::AccountState",
                                                      [],
                                                      "try_from_primitive",
                                                      []
                                                    |),
                                                    [
                                                      M.read (|
                                                        M.SubPointer.get_array_field (|
                                                          M.read (| state |),
                                                          M.alloc (| Value.Integer 0 |)
                                                        |)
                                                      |)
                                                    ]
                                                  |);
                                                  Value.StructTuple
                                                    "core::result::Result::Err"
                                                    [
                                                      Value.StructTuple
                                                        "solana_program::program_error::ProgramError::InvalidAccountData"
                                                        []
                                                    ]
                                                ]
                                              |)
                                            ]
                                          |)
                                        |),
                                        [
                                          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
                                                                "spl_token_2022::state::Account";
                                                              Ty.path
                                                                "solana_program::program_error::ProgramError"
                                                            ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              [
                                                                Ty.path "core::convert::Infallible";
                                                                Ty.path
                                                                  "solana_program::program_error::ProgramError"
                                                              ]
                                                          ],
                                                          "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))
                                        ]
                                      |)
                                    |));
                                  ("is_native",
                                    M.read (|
                                      M.match_operator (|
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::Try",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                [
                                                  Ty.apply
                                                    (Ty.path
                                                      "solana_program::program_option::COption")
                                                    [ Ty.path "u64" ];
                                                  Ty.path
                                                    "solana_program::program_error::ProgramError"
                                                ],
                                              [],
                                              "branch",
                                              []
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_function (|
                                                  "spl_token_2022::state::unpack_coption_u64",
                                                  []
                                                |),
                                                [ M.read (| is_native |) ]
                                              |)
                                            ]
                                          |)
                                        |),
                                        [
                                          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
                                                                "spl_token_2022::state::Account";
                                                              Ty.path
                                                                "solana_program::program_error::ProgramError"
                                                            ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              [
                                                                Ty.path "core::convert::Infallible";
                                                                Ty.path
                                                                  "solana_program::program_error::ProgramError"
                                                              ]
                                                          ],
                                                          "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))
                                        ]
                                      |)
                                    |));
                                  ("delegated_amount",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "u64",
                                        "from_le_bytes",
                                        []
                                      |),
                                      [ M.read (| M.read (| delegated_amount |) |) ]
                                    |));
                                  ("close_authority",
                                    M.read (|
                                      M.match_operator (|
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::Try",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                [
                                                  Ty.apply
                                                    (Ty.path
                                                      "solana_program::program_option::COption")
                                                    [ Ty.path "solana_program::pubkey::Pubkey" ];
                                                  Ty.path
                                                    "solana_program::program_error::ProgramError"
                                                ],
                                              [],
                                              "branch",
                                              []
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_function (|
                                                  "spl_token_2022::state::unpack_coption_key",
                                                  []
                                                |),
                                                [ M.read (| close_authority |) ]
                                              |)
                                            ]
                                          |)
                                        |),
                                        [
                                          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
                                                                "spl_token_2022::state::Account";
                                                              Ty.path
                                                                "solana_program::program_error::ProgramError"
                                                            ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              [
                                                                Ty.path "core::convert::Infallible";
                                                                Ty.path
                                                                  "solana_program::program_error::ProgramError"
                                                              ]
                                                          ],
                                                          "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))
                                        ]
                                      |)
                                    |))
                                ]
                            ]
                        |)))
                  ]
                |)
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    (*
        fn pack_into_slice(&self, dst: &mut [u8]) {
            let dst = array_mut_ref![dst, 0, 165];
            let (
                mint_dst,
                owner_dst,
                amount_dst,
                delegate_dst,
                state_dst,
                is_native_dst,
                delegated_amount_dst,
                close_authority_dst,
            ) = mut_array_refs![dst, 32, 32, 8, 36, 1, 12, 8, 36];
            let &Account {
                ref mint,
                ref owner,
                amount,
                ref delegate,
                state,
                ref is_native,
                delegated_amount,
                ref close_authority,
            } = self;
            mint_dst.copy_from_slice(mint.as_ref());
            owner_dst.copy_from_slice(owner.as_ref());
            *amount_dst = amount.to_le_bytes();
            pack_coption_key(delegate, delegate_dst);
            state_dst[0] = state as u8;
            pack_coption_u64(is_native, is_native_dst);
            *delegated_amount_dst = delegated_amount.to_le_bytes();
            pack_coption_key(close_authority, close_authority_dst);
        }
    *)
    Definition pack_into_slice (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; dst ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let dst := M.alloc (| dst |) in
          M.read (|
            let dst :=
              M.alloc (|
                M.read (|
                  let offset := M.alloc (| Value.Integer 0 |) in
                  let slice :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::index::IndexMut",
                          Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                          [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          M.read (| dst |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [
                              ("start", M.read (| offset |));
                              ("end_",
                                BinOp.Panic.add (|
                                  Integer.Usize,
                                  M.read (| offset |),
                                  Value.Integer 165
                                |))
                            ]
                        ]
                      |)
                    |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Self, "as_array.pack_into_slice", [] |),
                      [ M.read (| slice |) ]
                    |)
                  |)
                |)
              |) in
            M.match_operator (|
              let input := M.copy (| dst |) in
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Self, "as_arrays.pack_into_slice", [] |),
                  [ M.read (| input |) ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                    let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                    let γ0_2 := M.SubPointer.get_tuple_field (| γ, 2 |) in
                    let γ0_3 := M.SubPointer.get_tuple_field (| γ, 3 |) in
                    let γ0_4 := M.SubPointer.get_tuple_field (| γ, 4 |) in
                    let γ0_5 := M.SubPointer.get_tuple_field (| γ, 5 |) in
                    let γ0_6 := M.SubPointer.get_tuple_field (| γ, 6 |) in
                    let γ0_7 := M.SubPointer.get_tuple_field (| γ, 7 |) in
                    let mint_dst := M.copy (| γ0_0 |) in
                    let owner_dst := M.copy (| γ0_1 |) in
                    let amount_dst := M.copy (| γ0_2 |) in
                    let delegate_dst := M.copy (| γ0_3 |) in
                    let state_dst := M.copy (| γ0_4 |) in
                    let is_native_dst := M.copy (| γ0_5 |) in
                    let delegated_amount_dst := M.copy (| γ0_6 |) in
                    let close_authority_dst := M.copy (| γ0_7 |) in
                    M.match_operator (|
                      self,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ := M.read (| γ |) in
                            let γ1_0 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "mint"
                              |) in
                            let γ1_1 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "owner"
                              |) in
                            let γ1_2 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "amount"
                              |) in
                            let γ1_3 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "delegate"
                              |) in
                            let γ1_4 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "state"
                              |) in
                            let γ1_5 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "is_native"
                              |) in
                            let γ1_6 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "delegated_amount"
                              |) in
                            let γ1_7 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "spl_token_2022::state::Account",
                                "close_authority"
                              |) in
                            let mint := M.alloc (| γ1_0 |) in
                            let owner := M.alloc (| γ1_1 |) in
                            let amount := M.copy (| γ1_2 |) in
                            let delegate := M.alloc (| γ1_3 |) in
                            let state := M.copy (| γ1_4 |) in
                            let is_native := M.alloc (| γ1_5 |) in
                            let delegated_amount := M.copy (| γ1_6 |) in
                            let close_authority := M.alloc (| γ1_7 |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                                    "copy_from_slice",
                                    []
                                  |),
                                  [
                                    (* Unsize *) M.pointer_coercion (M.read (| mint_dst |));
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::convert::AsRef",
                                        Ty.path "solana_program::pubkey::Pubkey",
                                        [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] ],
                                        "as_ref",
                                        []
                                      |),
                                      [ M.read (| mint |) ]
                                    |)
                                  ]
                                |)
                              |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                                    "copy_from_slice",
                                    []
                                  |),
                                  [
                                    (* Unsize *) M.pointer_coercion (M.read (| owner_dst |));
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::convert::AsRef",
                                        Ty.path "solana_program::pubkey::Pubkey",
                                        [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] ],
                                        "as_ref",
                                        []
                                      |),
                                      [ M.read (| owner |) ]
                                    |)
                                  ]
                                |)
                              |) in
                            let _ :=
                              M.write (|
                                M.read (| amount_dst |),
                                M.call_closure (|
                                  M.get_associated_function (| Ty.path "u64", "to_le_bytes", [] |),
                                  [ M.read (| amount |) ]
                                |)
                              |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "spl_token_2022::state::pack_coption_key",
                                    []
                                  |),
                                  [ M.read (| delegate |); M.read (| delegate_dst |) ]
                                |)
                              |) in
                            let _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| state_dst |),
                                  M.alloc (| Value.Integer 0 |)
                                |),
                                M.rust_cast (M.read (| state |))
                              |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "spl_token_2022::state::pack_coption_u64",
                                    []
                                  |),
                                  [ M.read (| is_native |); M.read (| is_native_dst |) ]
                                |)
                              |) in
                            let _ :=
                              M.write (|
                                M.read (| delegated_amount_dst |),
                                M.call_closure (|
                                  M.get_associated_function (| Ty.path "u64", "to_le_bytes", [] |),
                                  [ M.read (| delegated_amount |) ]
                                |)
                              |) in
                            let _ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "spl_token_2022::state::pack_coption_key",
                                    []
                                  |),
                                  [ M.read (| close_authority |); M.read (| close_authority_dst |) ]
                                |)
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::Pack"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("value_LEN", InstanceField.Constant value_LEN);
          ("unpack_from_slice", InstanceField.Method unpack_from_slice);
          ("pack_into_slice", InstanceField.Method pack_into_slice)
        ].
  End Impl_solana_program_program_pack_Pack_for_spl_token_2022_state_Account.
  
  Module Impl_spl_token_2022_state_PackedSizeOf_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (*     const SIZE_OF: usize = Self::LEN; *)
    (* Ty.path "usize" *)
    Definition value_SIZE_OF : Value.t :=
      M.run ltac:(M.monadic (M.get_constant (| "solana_program::program_pack::Pack::LEN" |))).
    
    Axiom Implements :
      M.IsTraitInstance
        "spl_token_2022::state::PackedSizeOf"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("value_SIZE_OF", InstanceField.Constant value_SIZE_OF) ].
  End Impl_spl_token_2022_state_PackedSizeOf_for_spl_token_2022_state_Account.
  
  (*
  Enum AccountState
  {
    ty_params := [];
    variants :=
      [
        {
          name := "Uninitialized";
          item := StructTuple [];
          discriminant := None;
        };
        {
          name := "Initialized";
          item := StructTuple [];
          discriminant := None;
        };
        {
          name := "Frozen";
          item := StructTuple [];
          discriminant := None;
        }
      ];
  }
  *)
  
  Module Impl_core_clone_Clone_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    (* Clone *)
    Definition clone (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (| M.read (| self |) |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("clone", InstanceField.Method clone) ].
  End Impl_core_clone_Clone_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_marker_Copy_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Copy"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Copy_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_fmt_Debug_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    (* Debug *)
    Definition fmt (τ : 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.call_closure (|
            M.get_associated_function (| Ty.path "core::fmt::Formatter", "write_str", [] |),
            [
              M.read (| f |);
              M.read (|
                M.match_operator (|
                  self,
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        M.alloc (| M.read (| Value.String "Uninitialized" |) |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        M.alloc (| M.read (| Value.String "Initialized" |) |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.read (| γ |) in
                        M.alloc (| M.read (| Value.String "Frozen" |) |)))
                  ]
                |)
              |)
            ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_default_Default_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    (* Default *)
    Definition default (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [] =>
        ltac:(M.monadic (Value.StructTuple "spl_token_2022::state::AccountState::Uninitialized" []))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::default::Default"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("default", InstanceField.Method default) ].
  End Impl_core_default_Default_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::StructuralPartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_cmp_PartialEq_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    (* PartialEq *)
    Definition eq (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.read (|
            let __self_tag :=
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "core::intrinsics::discriminant_value",
                    [ Ty.path "spl_token_2022::state::AccountState" ]
                  |),
                  [ M.read (| self |) ]
                |)
              |) in
            let __arg1_tag :=
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "core::intrinsics::discriminant_value",
                    [ Ty.path "spl_token_2022::state::AccountState" ]
                  |),
                  [ M.read (| other |) ]
                |)
              |) in
            M.alloc (| BinOp.Pure.eq (M.read (| __self_tag |)) (M.read (| __arg1_tag |)) |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("eq", InstanceField.Method eq) ].
  End Impl_core_cmp_PartialEq_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_convert_From_spl_token_2022_state_AccountState_for_u8.
    Definition Self : Ty.t := Ty.path "u8".
    
    (* IntoPrimitive *)
    Definition from (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ enum_value ] =>
        ltac:(M.monadic
          (let enum_value := M.alloc (| enum_value |) in
          M.rust_cast (M.read (| enum_value |))))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "spl_token_2022::state::AccountState" ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_spl_token_2022_state_AccountState_for_u8.
  
  Module Impl_num_enum_TryFromPrimitive_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    (* TryFromPrimitive *)
    Definition _Primitive : Ty.t := Ty.path "u8".
    
    (* TryFromPrimitive *)
    Definition _Error : Ty.t :=
      Ty.apply
        (Ty.path "num_enum::TryFromPrimitiveError")
        [ Ty.path "spl_token_2022::state::AccountState" ].
    
    (* TryFromPrimitive *)
    (* Ty.apply (Ty.path "&") [ Ty.path "str" ] *)
    Definition value_NAME : Value.t := M.run ltac:(M.monadic (Value.String "AccountState")).
    
    (* TryFromPrimitive *)
    Definition try_from_primitive (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ number ] =>
        ltac:(M.monadic
          (let number := M.alloc (| number |) in
          M.read (|
            M.match_operator (|
              number,
              [
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Integer 0 |) in
                    M.alloc (|
                      Value.StructTuple
                        "core::result::Result::Ok"
                        [ Value.StructTuple "spl_token_2022::state::AccountState::Uninitialized" []
                        ]
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Integer 1 |) in
                    M.alloc (|
                      Value.StructTuple
                        "core::result::Result::Ok"
                        [ Value.StructTuple "spl_token_2022::state::AccountState::Initialized" [] ]
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Integer 2 |) in
                    M.alloc (|
                      Value.StructTuple
                        "core::result::Result::Ok"
                        [ Value.StructTuple "spl_token_2022::state::AccountState::Frozen" [] ]
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (M.alloc (|
                      Value.StructTuple
                        "core::result::Result::Err"
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "num_enum::TryFromPrimitiveError")
                                [ Ty.path "spl_token_2022::state::AccountState" ],
                              "new",
                              []
                            |),
                            [ M.read (| number |) ]
                          |)
                        ]
                    |)))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "num_enum::TryFromPrimitive"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("Primitive", InstanceField.Ty _Primitive);
          ("Error", InstanceField.Ty _Error);
          ("value_NAME", InstanceField.Constant value_NAME);
          ("try_from_primitive", InstanceField.Method try_from_primitive)
        ].
  End Impl_num_enum_TryFromPrimitive_for_spl_token_2022_state_AccountState.
  
  Module Impl_core_convert_TryFrom_u8_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    (* TryFromPrimitive *)
    Definition _Error : Ty.t :=
      Ty.apply
        (Ty.path "num_enum::TryFromPrimitiveError")
        [ Ty.path "spl_token_2022::state::AccountState" ].
    
    (* TryFromPrimitive *)
    Definition try_from (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ number ] =>
        ltac:(M.monadic
          (let number := M.alloc (| number |) in
          M.call_closure (|
            M.get_trait_method (|
              "num_enum::TryFromPrimitive",
              Ty.path "spl_token_2022::state::AccountState",
              [],
              "try_from_primitive",
              []
            |),
            [ M.read (| number |) ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::TryFrom"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "u8" ]
        (* Instance *)
        [ ("Error", InstanceField.Ty _Error); ("try_from", InstanceField.Method try_from) ].
  End Impl_core_convert_TryFrom_u8_for_spl_token_2022_state_AccountState.
  
  Module Impl_num_enum_CannotDeriveBothFromPrimitiveAndTryFromPrimitive_for_spl_token_2022_state_AccountState.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::AccountState".
    
    Axiom Implements :
      M.IsTraitInstance
        "num_enum::CannotDeriveBothFromPrimitiveAndTryFromPrimitive"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_num_enum_CannotDeriveBothFromPrimitiveAndTryFromPrimitive_for_spl_token_2022_state_AccountState.
  
  (* StructRecord
    {
      name := "Multisig";
      ty_params := [];
      fields :=
        [
          ("m", Ty.path "u8");
          ("n", Ty.path "u8");
          ("is_initialized", Ty.path "bool");
          ("signers", Ty.apply (Ty.path "array") [ Ty.path "solana_program::pubkey::Pubkey" ])
        ];
    } *)
  
  Module Impl_core_clone_Clone_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (* Clone *)
    Definition clone (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.match_operator (|
              Value.DeclaredButUndefined,
              [
                fun γ =>
                  ltac:(M.monadic
                    (M.match_operator (|
                      Value.DeclaredButUndefined,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (M.match_operator (|
                              Value.DeclaredButUndefined,
                              [ fun γ => ltac:(M.monadic (M.read (| self |))) ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("clone", InstanceField.Method clone) ].
  End Impl_core_clone_Clone_for_spl_token_2022_state_Multisig.
  
  Module Impl_core_marker_Copy_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Copy"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Copy_for_spl_token_2022_state_Multisig.
  
  Module Impl_core_fmt_Debug_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (* Debug *)
    Definition fmt (τ : 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.call_closure (|
            M.get_associated_function (|
              Ty.path "core::fmt::Formatter",
              "debug_struct_field4_finish",
              []
            |),
            [
              M.read (| f |);
              M.read (| Value.String "Multisig" |);
              M.read (| Value.String "m" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Multisig",
                  "m"
                |));
              M.read (| Value.String "n" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Multisig",
                  "n"
                |));
              M.read (| Value.String "is_initialized" |);
              (* Unsize *)
              M.pointer_coercion
                (M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "spl_token_2022::state::Multisig",
                  "is_initialized"
                |));
              M.read (| Value.String "signers" |);
              (* Unsize *)
              M.pointer_coercion
                (M.alloc (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "spl_token_2022::state::Multisig",
                    "signers"
                  |)
                |))
            ]
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_spl_token_2022_state_Multisig.
  
  Module Impl_core_default_Default_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (* Default *)
    Definition default (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [] =>
        ltac:(M.monadic
          (Value.StructRecord
            "spl_token_2022::state::Multisig"
            [
              ("m",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "u8",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("n",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "u8",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("is_initialized",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.path "bool",
                    [],
                    "default",
                    []
                  |),
                  []
                |));
              ("signers",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::default::Default",
                    Ty.apply (Ty.path "array") [ Ty.path "solana_program::pubkey::Pubkey" ],
                    [],
                    "default",
                    []
                  |),
                  []
                |))
            ]))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::default::Default"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("default", InstanceField.Method default) ].
  End Impl_core_default_Default_for_spl_token_2022_state_Multisig.
  
  Module Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::StructuralPartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_StructuralPartialEq_for_spl_token_2022_state_Multisig.
  
  Module Impl_core_cmp_PartialEq_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (* PartialEq *)
    Definition eq (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          LogicalOp.and (|
            LogicalOp.and (|
              LogicalOp.and (|
                BinOp.Pure.eq
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "spl_token_2022::state::Multisig",
                      "m"
                    |)
                  |))
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| other |),
                      "spl_token_2022::state::Multisig",
                      "m"
                    |)
                  |)),
                ltac:(M.monadic
                  (BinOp.Pure.eq
                    (M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "spl_token_2022::state::Multisig",
                        "n"
                      |)
                    |))
                    (M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| other |),
                        "spl_token_2022::state::Multisig",
                        "n"
                      |)
                    |))))
              |),
              ltac:(M.monadic
                (BinOp.Pure.eq
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "spl_token_2022::state::Multisig",
                      "is_initialized"
                    |)
                  |))
                  (M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| other |),
                      "spl_token_2022::state::Multisig",
                      "is_initialized"
                    |)
                  |))))
            |),
            ltac:(M.monadic
              (M.call_closure (|
                M.get_trait_method (|
                  "core::cmp::PartialEq",
                  Ty.apply (Ty.path "array") [ Ty.path "solana_program::pubkey::Pubkey" ],
                  [ Ty.apply (Ty.path "array") [ Ty.path "solana_program::pubkey::Pubkey" ] ],
                  "eq",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "spl_token_2022::state::Multisig",
                    "signers"
                  |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| other |),
                    "spl_token_2022::state::Multisig",
                    "signers"
                  |)
                ]
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("eq", InstanceField.Method eq) ].
  End Impl_core_cmp_PartialEq_for_spl_token_2022_state_Multisig.
  
  Module Impl_solana_program_program_pack_Sealed_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::Sealed"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_solana_program_program_pack_Sealed_for_spl_token_2022_state_Multisig.
  
  Module Impl_solana_program_program_pack_IsInitialized_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (*
        fn is_initialized(&self) -> bool {
            self.is_initialized
        }
    *)
    Definition is_initialized (τ : 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 |),
              "spl_token_2022::state::Multisig",
              "is_initialized"
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::IsInitialized"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("is_initialized", InstanceField.Method is_initialized) ].
  End Impl_solana_program_program_pack_IsInitialized_for_spl_token_2022_state_Multisig.
  
  Module Impl_solana_program_program_pack_Pack_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (*     const LEN: usize = 355; *)
    (* Ty.path "usize" *)
    Definition value_LEN : Value.t := M.run ltac:(M.monadic (M.alloc (| Value.Integer 355 |))).
    
    (*
        fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
            let src = array_ref![src, 0, 355];
            #[allow(clippy::ptr_offset_with_cast)]
            let (m, n, is_initialized, signers_flat) = array_refs![src, 1, 1, 1, 32 * MAX_SIGNERS];
            let mut result = Multisig {
                m: m[0],
                n: n[0],
                is_initialized: match is_initialized {
                    [0] => false,
                    [1] => true,
                    _ => return Err(ProgramError::InvalidAccountData),
                },
                signers: [Pubkey::new_from_array([0u8; 32]); MAX_SIGNERS],
            };
            for (src, dst) in signers_flat.chunks(32).zip(result.signers.iter_mut()) {
                *dst = Pubkey::try_from(src).map_err(|_| ProgramError::InvalidAccountData)?;
            }
            Ok(result)
        }
    *)
    Definition unpack_from_slice (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ src ] =>
        ltac:(M.monadic
          (let src := M.alloc (| src |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let src :=
                  M.copy (|
                    let offset := M.alloc (| Value.Integer 0 |) in
                    let slice :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::index::Index",
                            Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                            [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ],
                            "index",
                            []
                          |),
                          [
                            M.read (| src |);
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", M.read (| offset |));
                                ("end_",
                                  BinOp.Panic.add (|
                                    Integer.Usize,
                                    M.read (| offset |),
                                    Value.Integer 355
                                  |))
                              ]
                          ]
                        |)
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (| Self, "as_array.unpack_from_slice", [] |),
                        [ M.read (| slice |) ]
                      |)
                    |)
                  |) in
                M.match_operator (|
                  let input := M.copy (| src |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Self, "as_arrays.unpack_from_slice", [] |),
                      [ M.read (| input |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                        let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                        let γ0_2 := M.SubPointer.get_tuple_field (| γ, 2 |) in
                        let γ0_3 := M.SubPointer.get_tuple_field (| γ, 3 |) in
                        let m := M.copy (| γ0_0 |) in
                        let n := M.copy (| γ0_1 |) in
                        let is_initialized := M.copy (| γ0_2 |) in
                        let signers_flat := M.copy (| γ0_3 |) in
                        let result :=
                          M.alloc (|
                            Value.StructRecord
                              "spl_token_2022::state::Multisig"
                              [
                                ("m",
                                  M.read (|
                                    M.SubPointer.get_array_field (|
                                      M.read (| m |),
                                      M.alloc (| Value.Integer 0 |)
                                    |)
                                  |));
                                ("n",
                                  M.read (|
                                    M.SubPointer.get_array_field (|
                                      M.read (| n |),
                                      M.alloc (| Value.Integer 0 |)
                                    |)
                                  |));
                                ("is_initialized",
                                  M.read (|
                                    M.match_operator (|
                                      is_initialized,
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ := M.read (| γ |) in
                                            let γ1_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                                            let _ :=
                                              M.is_constant_or_break_match (|
                                                M.read (| γ1_0 |),
                                                Value.Integer 0
                                              |) in
                                            M.alloc (| Value.Bool false |)));
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ := M.read (| γ |) in
                                            let γ1_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                                            let _ :=
                                              M.is_constant_or_break_match (|
                                                M.read (| γ1_0 |),
                                                Value.Integer 1
                                              |) in
                                            M.alloc (| Value.Bool true |)));
                                        fun γ =>
                                          ltac:(M.monadic
                                            (M.alloc (|
                                              M.never_to_any (|
                                                M.read (|
                                                  M.return_ (|
                                                    Value.StructTuple
                                                      "core::result::Result::Err"
                                                      [
                                                        Value.StructTuple
                                                          "solana_program::program_error::ProgramError::InvalidAccountData"
                                                          []
                                                      ]
                                                  |)
                                                |)
                                              |)
                                            |)))
                                      ]
                                    |)
                                  |));
                                ("signers",
                                  repeat
                                    (M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "solana_program::pubkey::Pubkey",
                                        "new_from_array",
                                        []
                                      |),
                                      [ repeat (Value.Integer 0) 32 ]
                                    |))
                                    11)
                              ]
                          |) in
                        let _ :=
                          M.use
                            (M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::iter::traits::collect::IntoIterator",
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::zip::Zip")
                                      [
                                        Ty.apply
                                          (Ty.path "core::slice::iter::Chunks")
                                          [ Ty.path "u8" ];
                                        Ty.apply
                                          (Ty.path "core::slice::iter::IterMut")
                                          [ Ty.path "solana_program::pubkey::Pubkey" ]
                                      ],
                                    [],
                                    "into_iter",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::slice::iter::Chunks")
                                          [ Ty.path "u8" ],
                                        [],
                                        "zip",
                                        [
                                          Ty.apply
                                            (Ty.path "core::slice::iter::IterMut")
                                            [ Ty.path "solana_program::pubkey::Pubkey" ]
                                        ]
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                                            "chunks",
                                            []
                                          |),
                                          [
                                            (* Unsize *)
                                            M.pointer_coercion (M.read (| signers_flat |));
                                            Value.Integer 32
                                          ]
                                        |);
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "slice")
                                              [ Ty.path "solana_program::pubkey::Pubkey" ],
                                            "iter_mut",
                                            []
                                          |),
                                          [
                                            (* Unsize *)
                                            M.pointer_coercion
                                              (M.SubPointer.get_struct_record_field (|
                                                result,
                                                "spl_token_2022::state::Multisig",
                                                "signers"
                                              |))
                                          ]
                                        |)
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let iter := M.copy (| γ |) in
                                    M.loop (|
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::iter::traits::iterator::Iterator",
                                                  Ty.apply
                                                    (Ty.path "core::iter::adapters::zip::Zip")
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::slice::iter::Chunks")
                                                        [ Ty.path "u8" ];
                                                      Ty.apply
                                                        (Ty.path "core::slice::iter::IterMut")
                                                        [ Ty.path "solana_program::pubkey::Pubkey" ]
                                                    ],
                                                  [],
                                                  "next",
                                                  []
                                                |),
                                                [ iter ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (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 src := M.copy (| γ1_0 |) in
                                                  let dst := M.copy (| γ1_1 |) in
                                                  let _ :=
                                                    M.write (|
                                                      M.read (| dst |),
                                                      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
                                                                      "solana_program::pubkey::Pubkey";
                                                                    Ty.path
                                                                      "solana_program::program_error::ProgramError"
                                                                  ],
                                                                [],
                                                                "branch",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.apply
                                                                      (Ty.path
                                                                        "core::result::Result")
                                                                      [
                                                                        Ty.path
                                                                          "solana_program::pubkey::Pubkey";
                                                                        Ty.path
                                                                          "core::array::TryFromSliceError"
                                                                      ],
                                                                    "map_err",
                                                                    [
                                                                      Ty.path
                                                                        "solana_program::program_error::ProgramError";
                                                                      Ty.function
                                                                        [
                                                                          Ty.tuple
                                                                            [
                                                                              Ty.path
                                                                                "core::array::TryFromSliceError"
                                                                            ]
                                                                        ]
                                                                        (Ty.path
                                                                          "solana_program::program_error::ProgramError")
                                                                    ]
                                                                  |),
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::convert::TryFrom",
                                                                        Ty.path
                                                                          "solana_program::pubkey::Pubkey",
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path "&")
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path "slice")
                                                                                [ Ty.path "u8" ]
                                                                            ]
                                                                        ],
                                                                        "try_from",
                                                                        []
                                                                      |),
                                                                      [ M.read (| src |) ]
                                                                    |);
                                                                    M.closure
                                                                      (fun γ =>
                                                                        ltac:(M.monadic
                                                                          match γ with
                                                                          | [ α0 ] =>
                                                                            M.match_operator (|
                                                                              M.alloc (| α0 |),
                                                                              [
                                                                                fun γ =>
                                                                                  ltac:(M.monadic
                                                                                    (Value.StructTuple
                                                                                      "solana_program::program_error::ProgramError::InvalidAccountData"
                                                                                      []))
                                                                              ]
                                                                            |)
                                                                          | _ => M.impossible (||)
                                                                          end))
                                                                  ]
                                                                |)
                                                              ]
                                                            |)
                                                          |),
                                                          [
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let γ0_0 :=
                                                                  M.SubPointer.get_struct_tuple_field (|
                                                                    γ,
                                                                    "core::ops::control_flow::ControlFlow::Break",
                                                                    0
                                                                  |) in
                                                                let residual := M.copy (| γ0_0 |) in
                                                                M.alloc (|
                                                                  M.never_to_any (|
                                                                    M.read (|
                                                                      M.return_ (|
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "core::ops::try_trait::FromResidual",
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::result::Result")
                                                                              [
                                                                                Ty.path
                                                                                  "spl_token_2022::state::Multisig";
                                                                                Ty.path
                                                                                  "solana_program::program_error::ProgramError"
                                                                              ],
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "core::result::Result")
                                                                                [
                                                                                  Ty.path
                                                                                    "core::convert::Infallible";
                                                                                  Ty.path
                                                                                    "solana_program::program_error::ProgramError"
                                                                                ]
                                                                            ],
                                                                            "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" [ M.read (| result |) ]
                        |)))
                  ]
                |)
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    (*
        fn pack_into_slice(&self, dst: &mut [u8]) {
            let dst = array_mut_ref![dst, 0, 355];
            #[allow(clippy::ptr_offset_with_cast)]
            let (m, n, is_initialized, signers_flat) = mut_array_refs![dst, 1, 1, 1, 32 * MAX_SIGNERS];
            *m = [self.m];
            *n = [self.n];
            *is_initialized = [self.is_initialized as u8];
            for (i, src) in self.signers.iter().enumerate() {
                let dst_array = array_mut_ref![signers_flat, 32 * i, 32];
                dst_array.copy_from_slice(src.as_ref());
            }
        }
    *)
    Definition pack_into_slice (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ self; dst ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let dst := M.alloc (| dst |) in
          M.read (|
            let dst :=
              M.alloc (|
                M.read (|
                  let offset := M.alloc (| Value.Integer 0 |) in
                  let slice :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::index::IndexMut",
                          Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                          [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          M.read (| dst |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [
                              ("start", M.read (| offset |));
                              ("end_",
                                BinOp.Panic.add (|
                                  Integer.Usize,
                                  M.read (| offset |),
                                  Value.Integer 355
                                |))
                            ]
                        ]
                      |)
                    |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Self, "as_array.pack_into_slice", [] |),
                      [ M.read (| slice |) ]
                    |)
                  |)
                |)
              |) in
            M.match_operator (|
              let input := M.copy (| dst |) in
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Self, "as_arrays.pack_into_slice", [] |),
                  [ M.read (| input |) ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                    let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                    let γ0_2 := M.SubPointer.get_tuple_field (| γ, 2 |) in
                    let γ0_3 := M.SubPointer.get_tuple_field (| γ, 3 |) in
                    let m := M.copy (| γ0_0 |) in
                    let n := M.copy (| γ0_1 |) in
                    let is_initialized := M.copy (| γ0_2 |) in
                    let signers_flat := M.copy (| γ0_3 |) in
                    let _ :=
                      M.write (|
                        M.read (| m |),
                        Value.Array
                          [
                            M.read (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "spl_token_2022::state::Multisig",
                                "m"
                              |)
                            |)
                          ]
                      |) in
                    let _ :=
                      M.write (|
                        M.read (| n |),
                        Value.Array
                          [
                            M.read (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "spl_token_2022::state::Multisig",
                                "n"
                              |)
                            |)
                          ]
                      |) in
                    let _ :=
                      M.write (|
                        M.read (| is_initialized |),
                        Value.Array
                          [
                            M.rust_cast
                              (M.read (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "spl_token_2022::state::Multisig",
                                  "is_initialized"
                                |)
                              |))
                          ]
                      |) in
                    M.use
                      (M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::collect::IntoIterator",
                              Ty.apply
                                (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                [
                                  Ty.apply
                                    (Ty.path "core::slice::iter::Iter")
                                    [ Ty.path "solana_program::pubkey::Pubkey" ]
                                ],
                              [],
                              "into_iter",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply
                                    (Ty.path "core::slice::iter::Iter")
                                    [ Ty.path "solana_program::pubkey::Pubkey" ],
                                  [],
                                  "enumerate",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "slice")
                                        [ Ty.path "solana_program::pubkey::Pubkey" ],
                                      "iter",
                                      []
                                    |),
                                    [
                                      (* Unsize *)
                                      M.pointer_coercion
                                        (M.SubPointer.get_struct_record_field (|
                                          M.read (| self |),
                                          "spl_token_2022::state::Multisig",
                                          "signers"
                                        |))
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let iter := M.copy (| γ |) in
                              M.loop (|
                                ltac:(M.monadic
                                  (let _ :=
                                    M.match_operator (|
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::iter::traits::iterator::Iterator",
                                            Ty.apply
                                              (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::Iter")
                                                  [ Ty.path "solana_program::pubkey::Pubkey" ]
                                              ],
                                            [],
                                            "next",
                                            []
                                          |),
                                          [ iter ]
                                        |)
                                      |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (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 i := M.copy (| γ1_0 |) in
                                            let src := M.copy (| γ1_1 |) in
                                            let dst_array :=
                                              M.alloc (|
                                                M.read (|
                                                  let offset :=
                                                    M.alloc (|
                                                      BinOp.Panic.mul (|
                                                        Integer.Usize,
                                                        Value.Integer 32,
                                                        M.read (| i |)
                                                      |)
                                                    |) in
                                                  let slice :=
                                                    M.alloc (|
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::index::IndexMut",
                                                          Ty.apply
                                                            (Ty.path "array")
                                                            [ Ty.path "u8" ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "core::ops::range::Range")
                                                              [ Ty.path "usize" ]
                                                          ],
                                                          "index_mut",
                                                          []
                                                        |),
                                                        [
                                                          M.read (| signers_flat |);
                                                          Value.StructRecord
                                                            "core::ops::range::Range"
                                                            [
                                                              ("start", M.read (| offset |));
                                                              ("end_",
                                                                BinOp.Panic.add (|
                                                                  Integer.Usize,
                                                                  M.read (| offset |),
                                                                  Value.Integer 32
                                                                |))
                                                            ]
                                                        ]
                                                      |)
                                                    |) in
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Self,
                                                        "as_array.pack_into_slice",
                                                        []
                                                      |),
                                                      [ M.read (| slice |) ]
                                                    |)
                                                  |)
                                                |)
                                              |) in
                                            let _ :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                                                    "copy_from_slice",
                                                    []
                                                  |),
                                                  [
                                                    (* Unsize *)
                                                    M.pointer_coercion (M.read (| dst_array |));
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::convert::AsRef",
                                                        Ty.path "solana_program::pubkey::Pubkey",
                                                        [
                                                          Ty.apply
                                                            (Ty.path "slice")
                                                            [ Ty.path "u8" ]
                                                        ],
                                                        "as_ref",
                                                        []
                                                      |),
                                                      [ M.read (| src |) ]
                                                    |)
                                                  ]
                                                |)
                                              |) in
                                            M.alloc (| Value.Tuple [] |)))
                                      ]
                                    |) in
                                  M.alloc (| Value.Tuple [] |)))
                              |)))
                        ]
                      |))))
              ]
            |)
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "solana_program::program_pack::Pack"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("value_LEN", InstanceField.Constant value_LEN);
          ("unpack_from_slice", InstanceField.Method unpack_from_slice);
          ("pack_into_slice", InstanceField.Method pack_into_slice)
        ].
  End Impl_solana_program_program_pack_Pack_for_spl_token_2022_state_Multisig.
  
  Module Impl_spl_token_2022_state_PackedSizeOf_for_spl_token_2022_state_Multisig.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Multisig".
    
    (*     const SIZE_OF: usize = Self::LEN; *)
    (* Ty.path "usize" *)
    Definition value_SIZE_OF : Value.t :=
      M.run ltac:(M.monadic (M.get_constant (| "solana_program::program_pack::Pack::LEN" |))).
    
    Axiom Implements :
      M.IsTraitInstance
        "spl_token_2022::state::PackedSizeOf"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("value_SIZE_OF", InstanceField.Constant value_SIZE_OF) ].
  End Impl_spl_token_2022_state_PackedSizeOf_for_spl_token_2022_state_Multisig.
  
  (*
  pub(crate) fn pack_coption_key(src: &COption<Pubkey>, dst: &mut [u8; 36]) {
      let (tag, body) = mut_array_refs![dst, 4, 32];
      match src {
          COption::Some(key) => {
              *tag = [1, 0, 0, 0];
              body.copy_from_slice(key.as_ref());
          }
          COption::None => {
              *tag = [0; 4];
          }
      }
  }
  *)
  Definition pack_coption_key (τ : list Ty.t) (α : list Value.t) : M :=
    match τ, α with
    | [], [ src; dst ] =>
      ltac:(M.monadic
        (let src := M.alloc (| src |) in
        let dst := M.alloc (| dst |) in
        M.read (|
          M.match_operator (|
            let input := M.copy (| dst |) in
            M.alloc (|
              M.call_closure (|
                M.get_function (| "spl_token_2022::state::pack_coption_key.as_arrays", [] |),
                [ M.read (| input |) ]
              |)
            |),
            [
              fun γ =>
                ltac:(M.monadic
                  (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                  let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                  let tag := M.copy (| γ0_0 |) in
                  let body := M.copy (| γ0_1 |) in
                  M.match_operator (|
                    src,
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "solana_program::program_option::COption::Some",
                              0
                            |) in
                          let key := M.alloc (| γ1_0 |) in
                          let _ :=
                            M.write (|
                              M.read (| tag |),
                              Value.Array
                                [ Value.Integer 1; Value.Integer 0; Value.Integer 0; Value.Integer 0
                                ]
                            |) in
                          let _ :=
                            M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                                  "copy_from_slice",
                                  []
                                |),
                                [
                                  (* Unsize *) M.pointer_coercion (M.read (| body |));
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::convert::AsRef",
                                      Ty.path "solana_program::pubkey::Pubkey",
                                      [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] ],
                                      "as_ref",
                                      []
                                    |),
                                    [ M.read (| key |) ]
                                  |)
                                ]
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ := M.write (| M.read (| tag |), repeat (Value.Integer 0) 4 |) in
                          M.alloc (| Value.Tuple [] |)))
                    ]
                  |)))
            ]
          |)
        |)))
    | _, _ => M.impossible
    end.
  
  (*
  pub(crate) fn unpack_coption_key(src: &[u8; 36]) -> Result<COption<Pubkey>, ProgramError> {
      let (tag, body) = array_refs![src, 4, 32];
      match *tag {
          [0, 0, 0, 0] => Ok(COption::None),
          [1, 0, 0, 0] => Ok(COption::Some(Pubkey::new_from_array( *body))),
          _ => Err(ProgramError::InvalidAccountData),
      }
  }
  *)
  Definition unpack_coption_key (τ : list Ty.t) (α : list Value.t) : M :=
    match τ, α with
    | [], [ src ] =>
      ltac:(M.monadic
        (let src := M.alloc (| src |) in
        M.read (|
          M.match_operator (|
            let input := M.copy (| src |) in
            M.alloc (|
              M.call_closure (|
                M.get_function (| "spl_token_2022::state::unpack_coption_key.as_arrays", [] |),
                [ M.read (| input |) ]
              |)
            |),
            [
              fun γ =>
                ltac:(M.monadic
                  (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                  let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                  let tag := M.copy (| γ0_0 |) in
                  let body := M.copy (| γ0_1 |) in
                  M.match_operator (|
                    M.read (| tag |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                          let γ0_1 := M.SubPointer.get_slice_index (| γ, 1 |) in
                          let γ0_2 := M.SubPointer.get_slice_index (| γ, 2 |) in
                          let γ0_3 := M.SubPointer.get_slice_index (| γ, 3 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_1 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_2 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_3 |), Value.Integer 0 |) in
                          M.alloc (|
                            Value.StructTuple
                              "core::result::Result::Ok"
                              [ Value.StructTuple "solana_program::program_option::COption::None" []
                              ]
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                          let γ0_1 := M.SubPointer.get_slice_index (| γ, 1 |) in
                          let γ0_2 := M.SubPointer.get_slice_index (| γ, 2 |) in
                          let γ0_3 := M.SubPointer.get_slice_index (| γ, 3 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Integer 1 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_1 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_2 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_3 |), Value.Integer 0 |) in
                          M.alloc (|
                            Value.StructTuple
                              "core::result::Result::Ok"
                              [
                                Value.StructTuple
                                  "solana_program::program_option::COption::Some"
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "solana_program::pubkey::Pubkey",
                                        "new_from_array",
                                        []
                                      |),
                                      [ M.read (| M.read (| body |) |) ]
                                    |)
                                  ]
                              ]
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (M.alloc (|
                            Value.StructTuple
                              "core::result::Result::Err"
                              [
                                Value.StructTuple
                                  "solana_program::program_error::ProgramError::InvalidAccountData"
                                  []
                              ]
                          |)))
                    ]
                  |)))
            ]
          |)
        |)))
    | _, _ => M.impossible
    end.
  
  (*
  fn pack_coption_u64(src: &COption<u64>, dst: &mut [u8; 12]) {
      let (tag, body) = mut_array_refs![dst, 4, 8];
      match src {
          COption::Some(amount) => {
              *tag = [1, 0, 0, 0];
              *body = amount.to_le_bytes();
          }
          COption::None => {
              *tag = [0; 4];
          }
      }
  }
  *)
  Definition pack_coption_u64 (τ : list Ty.t) (α : list Value.t) : M :=
    match τ, α with
    | [], [ src; dst ] =>
      ltac:(M.monadic
        (let src := M.alloc (| src |) in
        let dst := M.alloc (| dst |) in
        M.read (|
          M.match_operator (|
            let input := M.copy (| dst |) in
            M.alloc (|
              M.call_closure (|
                M.get_function (| "spl_token_2022::state::pack_coption_u64.as_arrays", [] |),
                [ M.read (| input |) ]
              |)
            |),
            [
              fun γ =>
                ltac:(M.monadic
                  (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                  let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                  let tag := M.copy (| γ0_0 |) in
                  let body := M.copy (| γ0_1 |) in
                  M.match_operator (|
                    src,
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "solana_program::program_option::COption::Some",
                              0
                            |) in
                          let amount := M.alloc (| γ1_0 |) in
                          let _ :=
                            M.write (|
                              M.read (| tag |),
                              Value.Array
                                [ Value.Integer 1; Value.Integer 0; Value.Integer 0; Value.Integer 0
                                ]
                            |) in
                          let _ :=
                            M.write (|
                              M.read (| body |),
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "u64", "to_le_bytes", [] |),
                                [ M.read (| M.read (| amount |) |) ]
                              |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ := M.write (| M.read (| tag |), repeat (Value.Integer 0) 4 |) in
                          M.alloc (| Value.Tuple [] |)))
                    ]
                  |)))
            ]
          |)
        |)))
    | _, _ => M.impossible
    end.
  
  (*
  fn unpack_coption_u64(src: &[u8; 12]) -> Result<COption<u64>, ProgramError> {
      let (tag, body) = array_refs![src, 4, 8];
      match *tag {
          [0, 0, 0, 0] => Ok(COption::None),
          [1, 0, 0, 0] => Ok(COption::Some(u64::from_le_bytes( *body))),
          _ => Err(ProgramError::InvalidAccountData),
      }
  }
  *)
  Definition unpack_coption_u64 (τ : list Ty.t) (α : list Value.t) : M :=
    match τ, α with
    | [], [ src ] =>
      ltac:(M.monadic
        (let src := M.alloc (| src |) in
        M.read (|
          M.match_operator (|
            let input := M.copy (| src |) in
            M.alloc (|
              M.call_closure (|
                M.get_function (| "spl_token_2022::state::unpack_coption_u64.as_arrays", [] |),
                [ M.read (| input |) ]
              |)
            |),
            [
              fun γ =>
                ltac:(M.monadic
                  (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                  let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                  let tag := M.copy (| γ0_0 |) in
                  let body := M.copy (| γ0_1 |) in
                  M.match_operator (|
                    M.read (| tag |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                          let γ0_1 := M.SubPointer.get_slice_index (| γ, 1 |) in
                          let γ0_2 := M.SubPointer.get_slice_index (| γ, 2 |) in
                          let γ0_3 := M.SubPointer.get_slice_index (| γ, 3 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_1 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_2 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_3 |), Value.Integer 0 |) in
                          M.alloc (|
                            Value.StructTuple
                              "core::result::Result::Ok"
                              [ Value.StructTuple "solana_program::program_option::COption::None" []
                              ]
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                          let γ0_1 := M.SubPointer.get_slice_index (| γ, 1 |) in
                          let γ0_2 := M.SubPointer.get_slice_index (| γ, 2 |) in
                          let γ0_3 := M.SubPointer.get_slice_index (| γ, 3 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Integer 1 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_1 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_2 |), Value.Integer 0 |) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ0_3 |), Value.Integer 0 |) in
                          M.alloc (|
                            Value.StructTuple
                              "core::result::Result::Ok"
                              [
                                Value.StructTuple
                                  "solana_program::program_option::COption::Some"
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "u64",
                                        "from_le_bytes",
                                        []
                                      |),
                                      [ M.read (| M.read (| body |) |) ]
                                    |)
                                  ]
                              ]
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (M.alloc (|
                            Value.StructTuple
                              "core::result::Result::Err"
                              [
                                Value.StructTuple
                                  "solana_program::program_error::ProgramError::InvalidAccountData"
                                  []
                              ]
                          |)))
                    ]
                  |)))
            ]
          |)
        |)))
    | _, _ => M.impossible
    end.
  
  Definition value_ACCOUNTTYPE_ACCOUNT : Value.t :=
    M.run ltac:(M.monadic (M.alloc (| M.rust_cast (Value.Integer 2) |))).
  
  Module Impl_spl_token_2022_generic_token_account_GenericTokenAccount_for_spl_token_2022_state_Account.
    Definition Self : Ty.t := Ty.path "spl_token_2022::state::Account".
    
    (*
        fn valid_account_data(account_data: &[u8]) -> bool {
            // Use spl_token::state::Account::valid_account_data once possible
            account_data.len() == Account::LEN && is_initialized_account(account_data)
                || (account_data.len() > Account::LEN
                    && account_data.len() != Multisig::LEN
                    && ACCOUNTTYPE_ACCOUNT == account_data[Account::LEN]
                    && is_initialized_account(account_data))
        }
    *)
    Definition valid_account_data (τ : list Ty.t) (α : list Value.t) : M :=
      match τ, α with
      | [], [ account_data ] =>
        ltac:(M.monadic
          (let account_data := M.alloc (| account_data |) in
          LogicalOp.or (|
            LogicalOp.and (|
              BinOp.Pure.eq
                (M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                    "len",
                    []
                  |),
                  [ M.read (| account_data |) ]
                |))
                (M.read (| M.get_constant (| "solana_program::program_pack::Pack::LEN" |) |)),
              ltac:(M.monadic
                (M.call_closure (|
                  M.get_function (|
                    "spl_token_2022::generic_token_account::is_initialized_account",
                    []
                  |),
                  [ M.read (| account_data |) ]
                |)))
            |),
            ltac:(M.monadic
              (LogicalOp.and (|
                LogicalOp.and (|
                  LogicalOp.and (|
                    BinOp.Pure.gt
                      (M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                          "len",
                          []
                        |),
                        [ M.read (| account_data |) ]
                      |))
                      (M.read (| M.get_constant (| "solana_program::program_pack::Pack::LEN" |) |)),
                    ltac:(M.monadic
                      (BinOp.Pure.ne
                        (M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                            "len",
                            []
                          |),
                          [ M.read (| account_data |) ]
                        |))
                        (M.read (|
                          M.get_constant (| "solana_program::program_pack::Pack::LEN" |)
                        |))))
                  |),
                  ltac:(M.monadic
                    (BinOp.Pure.eq
                      (M.read (|
                        M.get_constant (| "spl_token_2022::state::ACCOUNTTYPE_ACCOUNT" |)
                      |))
                      (M.read (|
                        M.SubPointer.get_array_field (|
                          M.read (| account_data |),
                          M.get_constant (| "solana_program::program_pack::Pack::LEN" |)
                        |)
                      |))))
                |),
                ltac:(M.monadic
                  (M.call_closure (|
                    M.get_function (|
                      "spl_token_2022::generic_token_account::is_initialized_account",
                      []
                    |),
                    [ M.read (| account_data |) ]
                  |)))
              |)))
          |)))
      | _, _ => M.impossible
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "spl_token_2022::generic_token_account::GenericTokenAccount"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("valid_account_data", InstanceField.Method valid_account_data) ].
  End Impl_spl_token_2022_generic_token_account_GenericTokenAccount_for_spl_token_2022_state_Account.
End state.
