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

Module extension.
  Module confidential_transfer.
    Module ciphertext_extraction.
      (*
      pub(crate) fn extract_commitment_from_grouped_ciphertext(
          transfer_amount_ciphertext: &GroupedElGamalCiphertext2Handles,
      ) -> PedersenCommitment {
          let transfer_amount_ciphertext_bytes = bytemuck::bytes_of(transfer_amount_ciphertext);
          let transfer_amount_commitment_bytes =
              transfer_amount_ciphertext_bytes[..32].try_into().unwrap();
          PedersenCommitment(transfer_amount_commitment_bytes)
      }
      *)
      Definition extract_commitment_from_grouped_ciphertext
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        match τ, α with
        | [], [ transfer_amount_ciphertext ] =>
          ltac:(M.monadic
            (let transfer_amount_ciphertext := M.alloc (| transfer_amount_ciphertext |) in
            M.read (|
              let transfer_amount_ciphertext_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::grouped_elgamal::GroupedElGamalCiphertext2Handles"
                      ]
                    |),
                    [ M.read (| transfer_amount_ciphertext |) ]
                  |)
                |) in
              let transfer_amount_commitment_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply
                        (Ty.path "core::result::Result")
                        [
                          Ty.apply (Ty.path "array") [ Ty.path "u8" ];
                          Ty.path "core::array::TryFromSliceError"
                        ],
                      "unwrap",
                      []
                    |),
                    [
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::convert::TryInto",
                          Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] ],
                          [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ],
                          "try_into",
                          []
                        |),
                        [
                          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::RangeTo") [ Ty.path "usize" ]
                              ],
                              "index",
                              []
                            |),
                            [
                              M.read (| transfer_amount_ciphertext_bytes |);
                              Value.StructRecord
                                "core::ops::range::RangeTo"
                                [ ("end_", Value.Integer 32) ]
                            ]
                          |)
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                  [ M.read (| transfer_amount_commitment_bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      pub fn transfer_amount_source_ciphertext(
          transfer_amount_ciphertext: &TransferAmountCiphertext,
      ) -> ElGamalCiphertext {
          let transfer_amount_ciphertext_bytes = bytemuck::bytes_of(transfer_amount_ciphertext);
      
          let mut source_ciphertext_bytes = [0u8; 64];
          source_ciphertext_bytes[..32].copy_from_slice(&transfer_amount_ciphertext_bytes[..32]);
          source_ciphertext_bytes[32..].copy_from_slice(&transfer_amount_ciphertext_bytes[32..64]);
      
          ElGamalCiphertext(source_ciphertext_bytes)
      }
      *)
      Definition transfer_amount_source_ciphertext (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [], [ transfer_amount_ciphertext ] =>
          ltac:(M.monadic
            (let transfer_amount_ciphertext := M.alloc (| transfer_amount_ciphertext |) in
            M.read (|
              let transfer_amount_ciphertext_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext"
                      ]
                    |),
                    [ M.read (| transfer_amount_ciphertext |) ]
                  |)
                |) in
              let source_ciphertext_bytes := M.alloc (| repeat (Value.Integer 0) 64 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          source_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |);
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index",
                          []
                        |),
                        [
                          M.read (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeFrom") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          source_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeFrom"
                            [ ("start", Value.Integer 32) ]
                        ]
                      |);
                      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 (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 32); ("end_", Value.Integer 64) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalCiphertext"
                  [ M.read (| source_ciphertext_bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      pub(crate) fn transfer_amount_destination_ciphertext(
          transfer_amount_ciphertext: &TransferAmountCiphertext,
      ) -> ElGamalCiphertext {
          let transfer_amount_ciphertext_bytes = bytemuck::bytes_of(transfer_amount_ciphertext);
      
          let mut destination_ciphertext_bytes = [0u8; 64];
          destination_ciphertext_bytes[..32].copy_from_slice(&transfer_amount_ciphertext_bytes[..32]);
          destination_ciphertext_bytes[32..].copy_from_slice(&transfer_amount_ciphertext_bytes[64..96]);
      
          ElGamalCiphertext(destination_ciphertext_bytes)
      }
      *)
      Definition transfer_amount_destination_ciphertext (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [], [ transfer_amount_ciphertext ] =>
          ltac:(M.monadic
            (let transfer_amount_ciphertext := M.alloc (| transfer_amount_ciphertext |) in
            M.read (|
              let transfer_amount_ciphertext_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext"
                      ]
                    |),
                    [ M.read (| transfer_amount_ciphertext |) ]
                  |)
                |) in
              let destination_ciphertext_bytes := M.alloc (| repeat (Value.Integer 0) 64 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          destination_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |);
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index",
                          []
                        |),
                        [
                          M.read (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeFrom") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          destination_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeFrom"
                            [ ("start", Value.Integer 32) ]
                        ]
                      |);
                      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 (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 64); ("end_", Value.Integer 96) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalCiphertext"
                  [ M.read (| destination_ciphertext_bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      pub(crate) fn fee_amount_destination_ciphertext(
          transfer_amount_ciphertext: &EncryptedFee,
      ) -> ElGamalCiphertext {
          let transfer_amount_ciphertext_bytes = bytemuck::bytes_of(transfer_amount_ciphertext);
      
          let mut source_ciphertext_bytes = [0u8; 64];
          source_ciphertext_bytes[..32].copy_from_slice(&transfer_amount_ciphertext_bytes[..32]);
          source_ciphertext_bytes[32..].copy_from_slice(&transfer_amount_ciphertext_bytes[32..64]);
      
          ElGamalCiphertext(source_ciphertext_bytes)
      }
      *)
      Definition fee_amount_destination_ciphertext (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [], [ transfer_amount_ciphertext ] =>
          ltac:(M.monadic
            (let transfer_amount_ciphertext := M.alloc (| transfer_amount_ciphertext |) in
            M.read (|
              let transfer_amount_ciphertext_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::FeeEncryption"
                      ]
                    |),
                    [ M.read (| transfer_amount_ciphertext |) ]
                  |)
                |) in
              let source_ciphertext_bytes := M.alloc (| repeat (Value.Integer 0) 64 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          source_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |);
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index",
                          []
                        |),
                        [
                          M.read (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeFrom") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          source_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeFrom"
                            [ ("start", Value.Integer 32) ]
                        ]
                      |);
                      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 (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 32); ("end_", Value.Integer 64) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalCiphertext"
                  [ M.read (| source_ciphertext_bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      pub(crate) fn fee_amount_withdraw_withheld_authority_ciphertext(
          transfer_amount_ciphertext: &EncryptedFee,
      ) -> ElGamalCiphertext {
          let transfer_amount_ciphertext_bytes = bytemuck::bytes_of(transfer_amount_ciphertext);
      
          let mut destination_ciphertext_bytes = [0u8; 64];
          destination_ciphertext_bytes[..32].copy_from_slice(&transfer_amount_ciphertext_bytes[..32]);
          destination_ciphertext_bytes[32..].copy_from_slice(&transfer_amount_ciphertext_bytes[64..96]);
      
          ElGamalCiphertext(destination_ciphertext_bytes)
      }
      *)
      Definition fee_amount_withdraw_withheld_authority_ciphertext
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        match τ, α with
        | [], [ transfer_amount_ciphertext ] =>
          ltac:(M.monadic
            (let transfer_amount_ciphertext := M.alloc (| transfer_amount_ciphertext |) in
            M.read (|
              let transfer_amount_ciphertext_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::FeeEncryption"
                      ]
                    |),
                    [ M.read (| transfer_amount_ciphertext |) ]
                  |)
                |) in
              let destination_ciphertext_bytes := M.alloc (| repeat (Value.Integer 0) 64 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          destination_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |);
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index",
                          []
                        |),
                        [
                          M.read (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeFrom") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          destination_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeFrom"
                            [ ("start", Value.Integer 32) ]
                        ]
                      |);
                      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 (| transfer_amount_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 64); ("end_", Value.Integer 96) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalCiphertext"
                  [ M.read (| destination_ciphertext_bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      pub(crate) fn transfer_amount_encryption_from_decrypt_handle(
          source_decrypt_handle: &DecryptHandle,
          grouped_ciphertext: &GroupedElGamalCiphertext2Handles,
      ) -> TransferAmountCiphertext {
          let source_decrypt_handle_bytes = bytemuck::bytes_of(source_decrypt_handle);
          let grouped_ciphertext_bytes = bytemuck::bytes_of(grouped_ciphertext);
      
          let mut transfer_amount_ciphertext_bytes = [0u8; 128];
          transfer_amount_ciphertext_bytes[..32].copy_from_slice(&grouped_ciphertext_bytes[..32]);
          transfer_amount_ciphertext_bytes[32..64].copy_from_slice(source_decrypt_handle_bytes);
          transfer_amount_ciphertext_bytes[64..128].copy_from_slice(&grouped_ciphertext_bytes[32..96]);
      
          TransferAmountCiphertext(GroupedElGamalCiphertext3Handles(
              transfer_amount_ciphertext_bytes,
          ))
      }
      *)
      Definition transfer_amount_encryption_from_decrypt_handle
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        match τ, α with
        | [], [ source_decrypt_handle; grouped_ciphertext ] =>
          ltac:(M.monadic
            (let source_decrypt_handle := M.alloc (| source_decrypt_handle |) in
            let grouped_ciphertext := M.alloc (| grouped_ciphertext |) in
            M.read (|
              let source_decrypt_handle_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [ Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle"
                      ]
                    |),
                    [ M.read (| source_decrypt_handle |) ]
                  |)
                |) in
              let grouped_ciphertext_bytes :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "bytemuck::bytes_of",
                      [
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::grouped_elgamal::GroupedElGamalCiphertext2Handles"
                      ]
                    |),
                    [ M.read (| grouped_ciphertext |) ]
                  |)
                |) in
              let transfer_amount_ciphertext_bytes := M.alloc (| repeat (Value.Integer 0) 128 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          transfer_amount_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |);
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index",
                          []
                        |),
                        [
                          M.read (| grouped_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 32) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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",
                          []
                        |),
                        [
                          transfer_amount_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 32); ("end_", Value.Integer 64) ]
                        ]
                      |);
                      M.read (| source_decrypt_handle_bytes |)
                    ]
                  |)
                |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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",
                          []
                        |),
                        [
                          transfer_amount_ciphertext_bytes;
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 64); ("end_", Value.Integer 128) ]
                        ]
                      |);
                      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 (| grouped_ciphertext_bytes |);
                          Value.StructRecord
                            "core::ops::range::Range"
                            [ ("start", Value.Integer 32); ("end_", Value.Integer 96) ]
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext"
                  [
                    Value.StructTuple
                      "solana_zk_token_sdk::zk_token_elgamal::pod::grouped_elgamal::GroupedElGamalCiphertext3Handles"
                      [ M.read (| transfer_amount_ciphertext_bytes |) ]
                  ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (* StructRecord
        {
          name := "TransferPubkeysInfo";
          ty_params := [];
          fields :=
            [
              ("source",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey");
              ("destination",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey");
              ("auditor",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey")
            ];
        } *)
      
      (* StructRecord
        {
          name := "TransferProofContextInfo";
          ty_params := [];
          fields :=
            [
              ("ciphertext_lo",
                Ty.path
                  "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext");
              ("ciphertext_hi",
                Ty.path
                  "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext");
              ("transfer_pubkeys",
                Ty.path
                  "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferPubkeysInfo");
              ("new_source_ciphertext",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalCiphertext")
            ];
        } *)
      
      Module Impl_core_convert_From_solana_zk_token_sdk_instruction_transfer_without_fee_TransferProofContext_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferProofContextInfo.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferProofContextInfo".
        
        (*
            fn from(context: TransferProofContext) -> Self {
                let transfer_pubkeys = TransferPubkeysInfo {
                    source: context.transfer_pubkeys.source,
                    destination: context.transfer_pubkeys.destination,
                    auditor: context.transfer_pubkeys.auditor,
                };
        
                TransferProofContextInfo {
                    ciphertext_lo: context.ciphertext_lo,
                    ciphertext_hi: context.ciphertext_hi,
                    transfer_pubkeys,
                    new_source_ciphertext: context.new_source_ciphertext,
                }
            }
        *)
        Definition from (τ : list Ty.t) (α : list Value.t) : M :=
          match τ, α with
          | [], [ context ] =>
            ltac:(M.monadic
              (let context := M.alloc (| context |) in
              M.read (|
                let transfer_pubkeys :=
                  M.alloc (|
                    Value.StructRecord
                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferPubkeysInfo"
                      [
                        ("source",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext",
                                "transfer_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::without_fee::TransferPubkeys",
                              "source"
                            |)
                          |));
                        ("destination",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext",
                                "transfer_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::without_fee::TransferPubkeys",
                              "destination"
                            |)
                          |));
                        ("auditor",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext",
                                "transfer_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::without_fee::TransferPubkeys",
                              "auditor"
                            |)
                          |))
                      ]
                  |) in
                M.alloc (|
                  Value.StructRecord
                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferProofContextInfo"
                    [
                      ("ciphertext_lo",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext",
                            "ciphertext_lo"
                          |)
                        |));
                      ("ciphertext_hi",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext",
                            "ciphertext_hi"
                          |)
                        |));
                      ("transfer_pubkeys", M.read (| transfer_pubkeys |));
                      ("new_source_ciphertext",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext",
                            "new_source_ciphertext"
                          |)
                        |))
                    ]
                |)
              |)))
          | _, _ => M.impossible
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::convert::From"
            Self
            (* Trait polymorphic types *)
            [
              (* T *)
              Ty.path
                "solana_zk_token_sdk::instruction::transfer::without_fee::TransferProofContext"
            ]
            (* Instance *) [ ("from", InstanceField.Method from) ].
      End Impl_core_convert_From_solana_zk_token_sdk_instruction_transfer_without_fee_TransferProofContext_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferProofContextInfo.
      
      Module Impl_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferProofContextInfo.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferProofContextInfo".
        
        (*
            pub fn verify_and_extract(
                equality_proof_context: &CiphertextCommitmentEqualityProofContext,
                ciphertext_validity_proof_context: &BatchedGroupedCiphertext2HandlesValidityProofContext,
                range_proof_context: &BatchedRangeProofContext,
                source_decrypt_handles: &SourceDecryptHandles,
            ) -> Result<Self, ProgramError> {
                // The equality proof context consists of the source ElGamal public key, the new
                // source available balance ciphertext, and the new source available
                // commitment. The public key and ciphertext should be returned as parts
                // of `TransferProofContextInfo` and the commitment should be checked
                // with range proof for consistency.
                let CiphertextCommitmentEqualityProofContext {
                    pubkey: source_pubkey,
                    ciphertext: new_source_ciphertext,
                    commitment: new_source_commitment,
                } = equality_proof_context;
        
                // The ciphertext validity proof context consists of the destination ElGamal
                // public key, auditor ElGamal public key, and the transfer amount
                // ciphertexts. All of these fields should be returned as part of
                // `TransferProofContextInfo`. In addition, the commitments pertaining
                // to the transfer amount ciphertexts should be checked with range proof for
                // consistency.
                let BatchedGroupedCiphertext2HandlesValidityProofContext {
                    destination_pubkey,
                    auditor_pubkey,
                    grouped_ciphertext_lo: transfer_amount_ciphertext_lo,
                    grouped_ciphertext_hi: transfer_amount_ciphertext_hi,
                } = ciphertext_validity_proof_context;
        
                // The range proof context consists of the Pedersen commitments and bit-lengths
                // for which the range proof is proved. The commitments must consist of
                // three commitments pertaining to the new source available balance, the
                // low bits of the transfer amount, and high bits of the transfer
                // amount. These commitments must be checked for bit lengths `64`, `16`,
                // and `32`.
                let BatchedRangeProofContext {
                    commitments: range_proof_commitments,
                    bit_lengths: range_proof_bit_lengths,
                } = range_proof_context;
        
                // check that the range proof was created for the correct set of Pedersen
                // commitments
                let transfer_amount_commitment_lo =
                    extract_commitment_from_grouped_ciphertext(transfer_amount_ciphertext_lo);
                let transfer_amount_commitment_hi =
                    extract_commitment_from_grouped_ciphertext(transfer_amount_ciphertext_hi);
        
                let expected_commitments = [
                    *new_source_commitment,
                    transfer_amount_commitment_lo,
                    transfer_amount_commitment_hi,
                    // the fourth dummy commitment can be any commitment
                ];
        
                if !range_proof_commitments
                    .iter()
                    .zip(expected_commitments.iter())
                    .all(|(proof_commitment, expected_commitment)| proof_commitment == expected_commitment)
                {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                // check that the range proof was created for the correct number of bits
                const REMAINING_BALANCE_BIT_LENGTH: u8 = 64;
                const TRANSFER_AMOUNT_LO_BIT_LENGTH: u8 = 16;
                const TRANSFER_AMOUNT_HI_BIT_LENGTH: u8 = 32;
                const PADDING_BIT_LENGTH: u8 = 16;
                let expected_bit_lengths = [
                    REMAINING_BALANCE_BIT_LENGTH,
                    TRANSFER_AMOUNT_LO_BIT_LENGTH,
                    TRANSFER_AMOUNT_HI_BIT_LENGTH,
                    PADDING_BIT_LENGTH,
                ]
                .iter();
        
                if !range_proof_bit_lengths
                    .iter()
                    .zip(expected_bit_lengths)
                    .all(|(proof_len, expected_len)| proof_len == expected_len)
                {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                let transfer_pubkeys = TransferPubkeysInfo {
                    source: *source_pubkey,
                    destination: *destination_pubkey,
                    auditor: *auditor_pubkey,
                };
        
                let transfer_amount_ciphertext_lo = transfer_amount_encryption_from_decrypt_handle(
                    &source_decrypt_handles.lo,
                    transfer_amount_ciphertext_lo,
                );
        
                let transfer_amount_ciphertext_hi = transfer_amount_encryption_from_decrypt_handle(
                    &source_decrypt_handles.hi,
                    transfer_amount_ciphertext_hi,
                );
        
                Ok(Self {
                    ciphertext_lo: transfer_amount_ciphertext_lo,
                    ciphertext_hi: transfer_amount_ciphertext_hi,
                    transfer_pubkeys,
                    new_source_ciphertext: *new_source_ciphertext,
                })
            }
        *)
        Definition verify_and_extract (τ : list Ty.t) (α : list Value.t) : M :=
          match τ, α with
          | [],
              [
                equality_proof_context;
                ciphertext_validity_proof_context;
                range_proof_context;
                source_decrypt_handles
              ] =>
            ltac:(M.monadic
              (let equality_proof_context := M.alloc (| equality_proof_context |) in
              let ciphertext_validity_proof_context :=
                M.alloc (| ciphertext_validity_proof_context |) in
              let range_proof_context := M.alloc (| range_proof_context |) in
              let source_decrypt_handles := M.alloc (| source_decrypt_handles |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    M.match_operator (|
                      equality_proof_context,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ := M.read (| γ |) in
                            let γ1_0 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "solana_zk_token_sdk::instruction::ciphertext_commitment_equality::CiphertextCommitmentEqualityProofContext",
                                "pubkey"
                              |) in
                            let γ1_1 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "solana_zk_token_sdk::instruction::ciphertext_commitment_equality::CiphertextCommitmentEqualityProofContext",
                                "ciphertext"
                              |) in
                            let γ1_2 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "solana_zk_token_sdk::instruction::ciphertext_commitment_equality::CiphertextCommitmentEqualityProofContext",
                                "commitment"
                              |) in
                            let source_pubkey := M.alloc (| γ1_0 |) in
                            let new_source_ciphertext := M.alloc (| γ1_1 |) in
                            let new_source_commitment := M.alloc (| γ1_2 |) in
                            M.match_operator (|
                              ciphertext_validity_proof_context,
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ := M.read (| γ |) in
                                    let γ1_0 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "destination_pubkey"
                                      |) in
                                    let γ1_1 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "auditor_pubkey"
                                      |) in
                                    let γ1_2 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "grouped_ciphertext_lo"
                                      |) in
                                    let γ1_3 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "grouped_ciphertext_hi"
                                      |) in
                                    let destination_pubkey := M.alloc (| γ1_0 |) in
                                    let auditor_pubkey := M.alloc (| γ1_1 |) in
                                    let transfer_amount_ciphertext_lo := M.alloc (| γ1_2 |) in
                                    let transfer_amount_ciphertext_hi := M.alloc (| γ1_3 |) in
                                    M.match_operator (|
                                      range_proof_context,
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ := M.read (| γ |) in
                                            let γ1_0 :=
                                              M.SubPointer.get_struct_record_field (|
                                                γ,
                                                "solana_zk_token_sdk::instruction::batched_range_proof::BatchedRangeProofContext",
                                                "commitments"
                                              |) in
                                            let γ1_1 :=
                                              M.SubPointer.get_struct_record_field (|
                                                γ,
                                                "solana_zk_token_sdk::instruction::batched_range_proof::BatchedRangeProofContext",
                                                "bit_lengths"
                                              |) in
                                            let range_proof_commitments := M.alloc (| γ1_0 |) in
                                            let range_proof_bit_lengths := M.alloc (| γ1_1 |) in
                                            let transfer_amount_commitment_lo :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::extract_commitment_from_grouped_ciphertext",
                                                    []
                                                  |),
                                                  [ M.read (| transfer_amount_ciphertext_lo |) ]
                                                |)
                                              |) in
                                            let transfer_amount_commitment_hi :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::extract_commitment_from_grouped_ciphertext",
                                                    []
                                                  |),
                                                  [ M.read (| transfer_amount_ciphertext_hi |) ]
                                                |)
                                              |) in
                                            let expected_commitments :=
                                              M.alloc (|
                                                Value.Array
                                                  [
                                                    M.read (| M.read (| new_source_commitment |) |);
                                                    M.read (| transfer_amount_commitment_lo |);
                                                    M.read (| transfer_amount_commitment_hi |)
                                                  ]
                                              |) in
                                            let _ :=
                                              M.match_operator (|
                                                M.alloc (| Value.Tuple [] |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ :=
                                                        M.use
                                                          (M.alloc (|
                                                            UnOp.Pure.not
                                                              (M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "core::iter::traits::iterator::Iterator",
                                                                  Ty.apply
                                                                    (Ty.path
                                                                      "core::iter::adapters::zip::Zip")
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::slice::iter::Iter")
                                                                        [
                                                                          Ty.path
                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                        ];
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::slice::iter::Iter")
                                                                        [
                                                                          Ty.path
                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                        ]
                                                                    ],
                                                                  [],
                                                                  "all",
                                                                  [
                                                                    Ty.function
                                                                      [
                                                                        Ty.tuple
                                                                          [
                                                                            Ty.tuple
                                                                              [
                                                                                Ty.apply
                                                                                  (Ty.path "&")
                                                                                  [
                                                                                    Ty.path
                                                                                      "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                  ];
                                                                                Ty.apply
                                                                                  (Ty.path "&")
                                                                                  [
                                                                                    Ty.path
                                                                                      "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                  ]
                                                                              ]
                                                                          ]
                                                                      ]
                                                                      (Ty.path "bool")
                                                                  ]
                                                                |),
                                                                [
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::iter::traits::iterator::Iterator",
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::slice::iter::Iter")
                                                                          [
                                                                            Ty.path
                                                                              "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                          ],
                                                                        [],
                                                                        "zip",
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::slice::iter::Iter")
                                                                            [
                                                                              Ty.path
                                                                                "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                            ]
                                                                        ]
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path "slice")
                                                                              [
                                                                                Ty.path
                                                                                  "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                              ],
                                                                            "iter",
                                                                            []
                                                                          |),
                                                                          [
                                                                            (* Unsize *)
                                                                            M.pointer_coercion
                                                                              (M.read (|
                                                                                range_proof_commitments
                                                                              |))
                                                                          ]
                                                                        |);
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path "slice")
                                                                              [
                                                                                Ty.path
                                                                                  "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                              ],
                                                                            "iter",
                                                                            []
                                                                          |),
                                                                          [
                                                                            (* Unsize *)
                                                                            M.pointer_coercion
                                                                              expected_commitments
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |);
                                                                  M.closure
                                                                    (fun γ =>
                                                                      ltac:(M.monadic
                                                                        match γ with
                                                                        | [ α0 ] =>
                                                                          M.match_operator (|
                                                                            M.alloc (| α0 |),
                                                                            [
                                                                              fun γ =>
                                                                                ltac:(M.monadic
                                                                                  (let γ0_0 :=
                                                                                    M.SubPointer.get_tuple_field (|
                                                                                      γ,
                                                                                      0
                                                                                    |) in
                                                                                  let γ0_1 :=
                                                                                    M.SubPointer.get_tuple_field (|
                                                                                      γ,
                                                                                      1
                                                                                    |) in
                                                                                  let
                                                                                        proof_commitment :=
                                                                                    M.copy (|
                                                                                      γ0_0
                                                                                    |) in
                                                                                  let
                                                                                        expected_commitment :=
                                                                                    M.copy (|
                                                                                      γ0_1
                                                                                    |) in
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::cmp::PartialEq",
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "&")
                                                                                        [
                                                                                          Ty.path
                                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                        ],
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "&")
                                                                                          [
                                                                                            Ty.path
                                                                                              "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                          ]
                                                                                      ],
                                                                                      "eq",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      proof_commitment;
                                                                                      expected_commitment
                                                                                    ]
                                                                                  |)))
                                                                            ]
                                                                          |)
                                                                        | _ => M.impossible (||)
                                                                        end))
                                                                ]
                                                              |))
                                                          |)) in
                                                      let _ :=
                                                        M.is_constant_or_break_match (|
                                                          M.read (| γ |),
                                                          Value.Bool true
                                                        |) in
                                                      M.alloc (|
                                                        M.never_to_any (|
                                                          M.read (|
                                                            M.return_ (|
                                                              Value.StructTuple
                                                                "core::result::Result::Err"
                                                                [
                                                                  Value.StructTuple
                                                                    "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                    []
                                                                ]
                                                            |)
                                                          |)
                                                        |)
                                                      |)));
                                                  fun γ =>
                                                    ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                                ]
                                              |) in
                                            let expected_bit_lengths :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                                                    "iter",
                                                    []
                                                  |),
                                                  [
                                                    (* Unsize *)
                                                    M.pointer_coercion
                                                      (M.alloc (|
                                                        Value.Array
                                                          [
                                                            M.read (|
                                                              M.get_constant (|
                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::REMAINING_BALANCE_BIT_LENGTH"
                                                              |)
                                                            |);
                                                            M.read (|
                                                              M.get_constant (|
                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::TRANSFER_AMOUNT_LO_BIT_LENGTH"
                                                              |)
                                                            |);
                                                            M.read (|
                                                              M.get_constant (|
                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::TRANSFER_AMOUNT_HI_BIT_LENGTH"
                                                              |)
                                                            |);
                                                            M.read (|
                                                              M.get_constant (|
                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::PADDING_BIT_LENGTH"
                                                              |)
                                                            |)
                                                          ]
                                                      |))
                                                  ]
                                                |)
                                              |) in
                                            let _ :=
                                              M.match_operator (|
                                                M.alloc (| Value.Tuple [] |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ :=
                                                        M.use
                                                          (M.alloc (|
                                                            UnOp.Pure.not
                                                              (M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "core::iter::traits::iterator::Iterator",
                                                                  Ty.apply
                                                                    (Ty.path
                                                                      "core::iter::adapters::zip::Zip")
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::slice::iter::Iter")
                                                                        [ Ty.path "u8" ];
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::slice::iter::Iter")
                                                                        [ Ty.path "u8" ]
                                                                    ],
                                                                  [],
                                                                  "all",
                                                                  [
                                                                    Ty.function
                                                                      [
                                                                        Ty.tuple
                                                                          [
                                                                            Ty.tuple
                                                                              [
                                                                                Ty.apply
                                                                                  (Ty.path "&")
                                                                                  [ Ty.path "u8" ];
                                                                                Ty.apply
                                                                                  (Ty.path "&")
                                                                                  [ Ty.path "u8" ]
                                                                              ]
                                                                          ]
                                                                      ]
                                                                      (Ty.path "bool")
                                                                  ]
                                                                |),
                                                                [
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::iter::traits::iterator::Iterator",
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::slice::iter::Iter")
                                                                          [ Ty.path "u8" ],
                                                                        [],
                                                                        "zip",
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::slice::iter::Iter")
                                                                            [ Ty.path "u8" ]
                                                                        ]
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path "slice")
                                                                              [ Ty.path "u8" ],
                                                                            "iter",
                                                                            []
                                                                          |),
                                                                          [
                                                                            (* Unsize *)
                                                                            M.pointer_coercion
                                                                              (M.read (|
                                                                                range_proof_bit_lengths
                                                                              |))
                                                                          ]
                                                                        |);
                                                                        M.read (|
                                                                          expected_bit_lengths
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |);
                                                                  M.closure
                                                                    (fun γ =>
                                                                      ltac:(M.monadic
                                                                        match γ with
                                                                        | [ α0 ] =>
                                                                          M.match_operator (|
                                                                            M.alloc (| α0 |),
                                                                            [
                                                                              fun γ =>
                                                                                ltac:(M.monadic
                                                                                  (let γ0_0 :=
                                                                                    M.SubPointer.get_tuple_field (|
                                                                                      γ,
                                                                                      0
                                                                                    |) in
                                                                                  let γ0_1 :=
                                                                                    M.SubPointer.get_tuple_field (|
                                                                                      γ,
                                                                                      1
                                                                                    |) in
                                                                                  let proof_len :=
                                                                                    M.copy (|
                                                                                      γ0_0
                                                                                    |) in
                                                                                  let
                                                                                        expected_len :=
                                                                                    M.copy (|
                                                                                      γ0_1
                                                                                    |) in
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::cmp::PartialEq",
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "&")
                                                                                        [
                                                                                          Ty.path
                                                                                            "u8"
                                                                                        ],
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "&")
                                                                                          [
                                                                                            Ty.path
                                                                                              "u8"
                                                                                          ]
                                                                                      ],
                                                                                      "eq",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      proof_len;
                                                                                      expected_len
                                                                                    ]
                                                                                  |)))
                                                                            ]
                                                                          |)
                                                                        | _ => M.impossible (||)
                                                                        end))
                                                                ]
                                                              |))
                                                          |)) in
                                                      let _ :=
                                                        M.is_constant_or_break_match (|
                                                          M.read (| γ |),
                                                          Value.Bool true
                                                        |) in
                                                      M.alloc (|
                                                        M.never_to_any (|
                                                          M.read (|
                                                            M.return_ (|
                                                              Value.StructTuple
                                                                "core::result::Result::Err"
                                                                [
                                                                  Value.StructTuple
                                                                    "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                    []
                                                                ]
                                                            |)
                                                          |)
                                                        |)
                                                      |)));
                                                  fun γ =>
                                                    ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                                ]
                                              |) in
                                            let transfer_pubkeys :=
                                              M.alloc (|
                                                Value.StructRecord
                                                  "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferPubkeysInfo"
                                                  [
                                                    ("source",
                                                      M.read (| M.read (| source_pubkey |) |));
                                                    ("destination",
                                                      M.read (| M.read (| destination_pubkey |) |));
                                                    ("auditor",
                                                      M.read (| M.read (| auditor_pubkey |) |))
                                                  ]
                                              |) in
                                            let transfer_amount_ciphertext_lo :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::transfer_amount_encryption_from_decrypt_handle",
                                                    []
                                                  |),
                                                  [
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| source_decrypt_handles |),
                                                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                                                      "lo"
                                                    |);
                                                    M.read (| transfer_amount_ciphertext_lo |)
                                                  ]
                                                |)
                                              |) in
                                            let transfer_amount_ciphertext_hi :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::transfer_amount_encryption_from_decrypt_handle",
                                                    []
                                                  |),
                                                  [
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| source_decrypt_handles |),
                                                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                                                      "hi"
                                                    |);
                                                    M.read (| transfer_amount_ciphertext_hi |)
                                                  ]
                                                |)
                                              |) in
                                            M.alloc (|
                                              Value.StructTuple
                                                "core::result::Result::Ok"
                                                [
                                                  Value.StructRecord
                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferProofContextInfo"
                                                    [
                                                      ("ciphertext_lo",
                                                        M.read (| transfer_amount_ciphertext_lo |));
                                                      ("ciphertext_hi",
                                                        M.read (| transfer_amount_ciphertext_hi |));
                                                      ("transfer_pubkeys",
                                                        M.read (| transfer_pubkeys |));
                                                      ("new_source_ciphertext",
                                                        M.read (|
                                                          M.read (| new_source_ciphertext |)
                                                        |))
                                                    ]
                                                ]
                                            |)))
                                      ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)
                  |)))
              |)))
          | _, _ => M.impossible
          end.
        
        Axiom AssociatedFunction_verify_and_extract :
          M.IsAssociatedFunction Self "verify_and_extract" verify_and_extract.
      End Impl_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferProofContextInfo.
      
      (* StructRecord
        {
          name := "TransferWithFeePubkeysInfo";
          ty_params := [];
          fields :=
            [
              ("source",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey");
              ("destination",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey");
              ("auditor",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey");
              ("withdraw_withheld_authority",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey")
            ];
        } *)
      
      (* StructRecord
        {
          name := "TransferWithFeeProofContextInfo";
          ty_params := [];
          fields :=
            [
              ("ciphertext_lo",
                Ty.path
                  "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext");
              ("ciphertext_hi",
                Ty.path
                  "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::TransferAmountCiphertext");
              ("transfer_with_fee_pubkeys",
                Ty.path
                  "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeePubkeysInfo");
              ("new_source_ciphertext",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalCiphertext");
              ("fee_ciphertext_lo",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::FeeEncryption");
              ("fee_ciphertext_hi",
                Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::FeeEncryption")
            ];
        } *)
      
      Module Impl_core_convert_From_solana_zk_token_sdk_instruction_transfer_with_fee_TransferWithFeeProofContext_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferWithFeeProofContextInfo.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo".
        
        (*
            fn from(context: TransferWithFeeProofContext) -> Self {
                let transfer_with_fee_pubkeys = TransferWithFeePubkeysInfo {
                    source: context.transfer_with_fee_pubkeys.source,
                    destination: context.transfer_with_fee_pubkeys.destination,
                    auditor: context.transfer_with_fee_pubkeys.auditor,
                    withdraw_withheld_authority: context
                        .transfer_with_fee_pubkeys
                        .withdraw_withheld_authority,
                };
        
                TransferWithFeeProofContextInfo {
                    ciphertext_lo: context.ciphertext_lo,
                    ciphertext_hi: context.ciphertext_hi,
                    transfer_with_fee_pubkeys,
                    new_source_ciphertext: context.new_source_ciphertext,
                    fee_ciphertext_lo: context.fee_ciphertext_lo,
                    fee_ciphertext_hi: context.fee_ciphertext_hi,
                }
            }
        *)
        Definition from (τ : list Ty.t) (α : list Value.t) : M :=
          match τ, α with
          | [], [ context ] =>
            ltac:(M.monadic
              (let context := M.alloc (| context |) in
              M.read (|
                let transfer_with_fee_pubkeys :=
                  M.alloc (|
                    Value.StructRecord
                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeePubkeysInfo"
                      [
                        ("source",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                                "transfer_with_fee_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeePubkeys",
                              "source"
                            |)
                          |));
                        ("destination",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                                "transfer_with_fee_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeePubkeys",
                              "destination"
                            |)
                          |));
                        ("auditor",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                                "transfer_with_fee_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeePubkeys",
                              "auditor"
                            |)
                          |));
                        ("withdraw_withheld_authority",
                          M.read (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                context,
                                "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                                "transfer_with_fee_pubkeys"
                              |),
                              "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeePubkeys",
                              "withdraw_withheld_authority"
                            |)
                          |))
                      ]
                  |) in
                M.alloc (|
                  Value.StructRecord
                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo"
                    [
                      ("ciphertext_lo",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                            "ciphertext_lo"
                          |)
                        |));
                      ("ciphertext_hi",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                            "ciphertext_hi"
                          |)
                        |));
                      ("transfer_with_fee_pubkeys", M.read (| transfer_with_fee_pubkeys |));
                      ("new_source_ciphertext",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                            "new_source_ciphertext"
                          |)
                        |));
                      ("fee_ciphertext_lo",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                            "fee_ciphertext_lo"
                          |)
                        |));
                      ("fee_ciphertext_hi",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            context,
                            "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext",
                            "fee_ciphertext_hi"
                          |)
                        |))
                    ]
                |)
              |)))
          | _, _ => M.impossible
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::convert::From"
            Self
            (* Trait polymorphic types *)
            [
              (* T *)
              Ty.path
                "solana_zk_token_sdk::instruction::transfer::with_fee::TransferWithFeeProofContext"
            ]
            (* Instance *) [ ("from", InstanceField.Method from) ].
      End Impl_core_convert_From_solana_zk_token_sdk_instruction_transfer_with_fee_TransferWithFeeProofContext_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferWithFeeProofContextInfo.
      
      Module Impl_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferWithFeeProofContextInfo.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo".
        
        (*
            pub fn verify_and_extract(
                equality_proof_context: &CiphertextCommitmentEqualityProofContext,
                transfer_amount_ciphertext_validity_proof_context: &BatchedGroupedCiphertext2HandlesValidityProofContext,
                fee_sigma_proof_context: &FeeSigmaProofContext,
                fee_ciphertext_validity_proof_context: &BatchedGroupedCiphertext2HandlesValidityProofContext,
                range_proof_context: &BatchedRangeProofContext,
                source_decrypt_handles: &SourceDecryptHandles,
                fee_parameters: &TransferFee,
            ) -> Result<Self, ProgramError> {
                // The equality proof context consists of the source ElGamal public key, the new
                // source available balance ciphertext, and the new source available
                // commitment. The public key and ciphertext should be returned as part
                // of `TransferWithFeeProofContextInfo` and the commitment should be
                // checked with range proof for consistency.
                let CiphertextCommitmentEqualityProofContext {
                    pubkey: source_pubkey,
                    ciphertext: new_source_ciphertext,
                    commitment: new_source_commitment,
                } = equality_proof_context;
        
                // The transfer amount ciphertext validity proof context consists of the
                // destination ElGamal public key, auditor ElGamal public key, and the
                // transfer amount ciphertexts. All of these fields should be returned
                // as part of `TransferWithFeeProofContextInfo`. In addition, the
                // commitments pertaining to the transfer amount ciphertexts should be
                // checked with range proof for consistency.
                let BatchedGroupedCiphertext2HandlesValidityProofContext {
                    destination_pubkey,
                    auditor_pubkey,
                    grouped_ciphertext_lo: transfer_amount_ciphertext_lo,
                    grouped_ciphertext_hi: transfer_amount_ciphertext_hi,
                } = transfer_amount_ciphertext_validity_proof_context;
        
                // The fee sigma proof context consists of the fee commitment, delta commitment,
                // claimed commitment, and max fee. The fee and claimed commitment
                // should be checked with range proof for consistency. The delta
                // commitment should be checked whether it is properly generated with
                // respect to the fee parameters. The max fee should be checked for
                // consistency with the fee parameters.
                let FeeSigmaProofContext {
                    fee_commitment,
                    delta_commitment,
                    claimed_commitment,
                    max_fee,
                } = fee_sigma_proof_context;
        
                let expected_maximum_fee: u64 = fee_parameters.maximum_fee.into();
                let proof_maximum_fee: u64 = ( *max_fee).into();
                if expected_maximum_fee != proof_maximum_fee {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                // The transfer fee ciphertext validity proof context consists of the
                // destination ElGamal public key, withdraw withheld authority ElGamal
                // public key, and the transfer fee ciphertexts. The rest of the fields
                // should be return as part of `TransferWithFeeProofContextInfo`. In
                // addition, the destination public key should be checked for
                // consistency with the destination public key contained in the transfer amount
                // ciphertext validity proof, and the commitments pertaining to the transfer fee
                // amount ciphertexts should be checked with range proof for
                // consistency.
                let BatchedGroupedCiphertext2HandlesValidityProofContext {
                    destination_pubkey: destination_pubkey_from_transfer_fee_validity_proof,
                    auditor_pubkey: withdraw_withheld_authority_pubkey,
                    grouped_ciphertext_lo: fee_ciphertext_lo,
                    grouped_ciphertext_hi: fee_ciphertext_hi,
                } = fee_ciphertext_validity_proof_context;
        
                if destination_pubkey != destination_pubkey_from_transfer_fee_validity_proof {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                // The range proof context consists of the Pedersen commitments and bit-lengths
                // for which the range proof is proved. The commitments must consist of
                // seven commitments pertaining to
                // - the new source available balance (64 bits)
                // - the low bits of the transfer amount (16 bits)
                // - the high bits of the transfer amount (32 bits)
                // - the delta amount for the fee (48 bits)
                // - the complement of the delta amount for the fee (48 bits)
                // - the low bits of the fee amount (16 bits)
                // - the high bits of the fee amount (32 bits)
                let BatchedRangeProofContext {
                    commitments: range_proof_commitments,
                    bit_lengths: range_proof_bit_lengths,
                } = range_proof_context;
        
                // check that the range proof was created for the correct set of Pedersen
                // commitments
                let transfer_amount_commitment_lo =
                    extract_commitment_from_grouped_ciphertext(transfer_amount_ciphertext_lo);
                let transfer_amount_commitment_hi =
                    extract_commitment_from_grouped_ciphertext(transfer_amount_ciphertext_hi);
        
                let fee_commitment_lo = extract_commitment_from_grouped_ciphertext(fee_ciphertext_lo);
                let fee_commitment_hi = extract_commitment_from_grouped_ciphertext(fee_ciphertext_hi);
        
                const MAX_FEE_BASIS_POINTS: u64 = 10_000;
                let max_fee_basis_points_scalar = u64_to_scalar(MAX_FEE_BASIS_POINTS);
                let max_fee_basis_points_commitment =
                    ristretto::multiply_ristretto(&max_fee_basis_points_scalar, &G)
                        .ok_or(TokenError::CiphertextArithmeticFailed)?;
                let claimed_complement_commitment = ristretto::subtract_ristretto(
                    &max_fee_basis_points_commitment,
                    &( *claimed_commitment).into(),
                )
                .ok_or(TokenError::CiphertextArithmeticFailed)?;
        
                let expected_commitments = [
                    *new_source_commitment,
                    transfer_amount_commitment_lo,
                    transfer_amount_commitment_hi,
                    *claimed_commitment,
                    claimed_complement_commitment.into(),
                    fee_commitment_lo,
                    fee_commitment_hi,
                ];
        
                if !range_proof_commitments
                    .iter()
                    .zip(expected_commitments.iter())
                    .all(|(proof_commitment, expected_commitment)| proof_commitment == expected_commitment)
                {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                // check that the range proof was created for the correct number of bits
                const REMAINING_BALANCE_BIT_LENGTH: u8 = 64;
                const TRANSFER_AMOUNT_LO_BIT_LENGTH: u8 = 16;
                const TRANSFER_AMOUNT_HI_BIT_LENGTH: u8 = 32;
                const DELTA_BIT_LENGTH: u8 = 48;
                const FEE_AMOUNT_LO_BIT_LENGTH: u8 = 16;
                const FEE_AMOUNT_HI_BIT_LENGTH: u8 = 32;
        
                let expected_bit_lengths = [
                    REMAINING_BALANCE_BIT_LENGTH,
                    TRANSFER_AMOUNT_LO_BIT_LENGTH,
                    TRANSFER_AMOUNT_HI_BIT_LENGTH,
                    DELTA_BIT_LENGTH,
                    DELTA_BIT_LENGTH,
                    FEE_AMOUNT_LO_BIT_LENGTH,
                    FEE_AMOUNT_HI_BIT_LENGTH,
                ]
                .iter();
        
                if !range_proof_bit_lengths
                    .iter()
                    .zip(expected_bit_lengths)
                    .all(|(proof_len, expected_len)| proof_len == expected_len)
                {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                // check consistency between fee sigma and fee ciphertext validity proofs
                let sigma_proof_fee_commitment_point: PodRistrettoPoint = ( *fee_commitment).into();
                let validity_proof_fee_point =
                    combine_lo_hi_pedersen_points(&fee_commitment_lo.into(), &fee_commitment_hi.into())
                        .ok_or(TokenError::CiphertextArithmeticFailed)?;
                if validity_proof_fee_point != sigma_proof_fee_commitment_point {
                    return Err(ProgramError::InvalidInstructionData);
                }
        
                verify_delta_commitment(
                    &transfer_amount_commitment_lo,
                    &transfer_amount_commitment_hi,
                    fee_commitment,
                    delta_commitment,
                    fee_parameters.transfer_fee_basis_points.into(),
                )?;
        
                // create transfer with fee proof context info and return
                let transfer_with_fee_pubkeys = TransferWithFeePubkeysInfo {
                    source: *source_pubkey,
                    destination: *destination_pubkey,
                    auditor: *auditor_pubkey,
                    withdraw_withheld_authority: *withdraw_withheld_authority_pubkey,
                };
        
                let transfer_amount_ciphertext_lo = transfer_amount_encryption_from_decrypt_handle(
                    &source_decrypt_handles.lo,
                    transfer_amount_ciphertext_lo,
                );
        
                let transfer_amount_ciphertext_hi = transfer_amount_encryption_from_decrypt_handle(
                    &source_decrypt_handles.hi,
                    transfer_amount_ciphertext_hi,
                );
        
                Ok(Self {
                    ciphertext_lo: transfer_amount_ciphertext_lo,
                    ciphertext_hi: transfer_amount_ciphertext_hi,
                    transfer_with_fee_pubkeys,
                    new_source_ciphertext: *new_source_ciphertext,
                    fee_ciphertext_lo: FeeEncryption( *fee_ciphertext_lo),
                    fee_ciphertext_hi: FeeEncryption( *fee_ciphertext_hi),
                })
            }
        *)
        Definition verify_and_extract (τ : list Ty.t) (α : list Value.t) : M :=
          match τ, α with
          | [],
              [
                equality_proof_context;
                transfer_amount_ciphertext_validity_proof_context;
                fee_sigma_proof_context;
                fee_ciphertext_validity_proof_context;
                range_proof_context;
                source_decrypt_handles;
                fee_parameters
              ] =>
            ltac:(M.monadic
              (let equality_proof_context := M.alloc (| equality_proof_context |) in
              let transfer_amount_ciphertext_validity_proof_context :=
                M.alloc (| transfer_amount_ciphertext_validity_proof_context |) in
              let fee_sigma_proof_context := M.alloc (| fee_sigma_proof_context |) in
              let fee_ciphertext_validity_proof_context :=
                M.alloc (| fee_ciphertext_validity_proof_context |) in
              let range_proof_context := M.alloc (| range_proof_context |) in
              let source_decrypt_handles := M.alloc (| source_decrypt_handles |) in
              let fee_parameters := M.alloc (| fee_parameters |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    M.match_operator (|
                      equality_proof_context,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ := M.read (| γ |) in
                            let γ1_0 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "solana_zk_token_sdk::instruction::ciphertext_commitment_equality::CiphertextCommitmentEqualityProofContext",
                                "pubkey"
                              |) in
                            let γ1_1 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "solana_zk_token_sdk::instruction::ciphertext_commitment_equality::CiphertextCommitmentEqualityProofContext",
                                "ciphertext"
                              |) in
                            let γ1_2 :=
                              M.SubPointer.get_struct_record_field (|
                                γ,
                                "solana_zk_token_sdk::instruction::ciphertext_commitment_equality::CiphertextCommitmentEqualityProofContext",
                                "commitment"
                              |) in
                            let source_pubkey := M.alloc (| γ1_0 |) in
                            let new_source_ciphertext := M.alloc (| γ1_1 |) in
                            let new_source_commitment := M.alloc (| γ1_2 |) in
                            M.match_operator (|
                              transfer_amount_ciphertext_validity_proof_context,
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ := M.read (| γ |) in
                                    let γ1_0 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "destination_pubkey"
                                      |) in
                                    let γ1_1 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "auditor_pubkey"
                                      |) in
                                    let γ1_2 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "grouped_ciphertext_lo"
                                      |) in
                                    let γ1_3 :=
                                      M.SubPointer.get_struct_record_field (|
                                        γ,
                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                        "grouped_ciphertext_hi"
                                      |) in
                                    let destination_pubkey := M.alloc (| γ1_0 |) in
                                    let auditor_pubkey := M.alloc (| γ1_1 |) in
                                    let transfer_amount_ciphertext_lo := M.alloc (| γ1_2 |) in
                                    let transfer_amount_ciphertext_hi := M.alloc (| γ1_3 |) in
                                    M.match_operator (|
                                      fee_sigma_proof_context,
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ := M.read (| γ |) in
                                            let γ1_0 :=
                                              M.SubPointer.get_struct_record_field (|
                                                γ,
                                                "solana_zk_token_sdk::instruction::fee_sigma::FeeSigmaProofContext",
                                                "fee_commitment"
                                              |) in
                                            let γ1_1 :=
                                              M.SubPointer.get_struct_record_field (|
                                                γ,
                                                "solana_zk_token_sdk::instruction::fee_sigma::FeeSigmaProofContext",
                                                "delta_commitment"
                                              |) in
                                            let γ1_2 :=
                                              M.SubPointer.get_struct_record_field (|
                                                γ,
                                                "solana_zk_token_sdk::instruction::fee_sigma::FeeSigmaProofContext",
                                                "claimed_commitment"
                                              |) in
                                            let γ1_3 :=
                                              M.SubPointer.get_struct_record_field (|
                                                γ,
                                                "solana_zk_token_sdk::instruction::fee_sigma::FeeSigmaProofContext",
                                                "max_fee"
                                              |) in
                                            let fee_commitment := M.alloc (| γ1_0 |) in
                                            let delta_commitment := M.alloc (| γ1_1 |) in
                                            let claimed_commitment := M.alloc (| γ1_2 |) in
                                            let max_fee := M.alloc (| γ1_3 |) in
                                            let expected_maximum_fee :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::convert::Into",
                                                    Ty.path "spl_pod::primitives::PodU64",
                                                    [ Ty.path "u64" ],
                                                    "into",
                                                    []
                                                  |),
                                                  [
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| fee_parameters |),
                                                        "spl_token_2022::extension::transfer_fee::TransferFee",
                                                        "maximum_fee"
                                                      |)
                                                    |)
                                                  ]
                                                |)
                                              |) in
                                            let proof_maximum_fee :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::convert::Into",
                                                    Ty.path
                                                      "solana_zk_token_sdk::zk_token_elgamal::pod::PodU64",
                                                    [ Ty.path "u64" ],
                                                    "into",
                                                    []
                                                  |),
                                                  [ M.read (| M.read (| max_fee |) |) ]
                                                |)
                                              |) in
                                            let _ :=
                                              M.match_operator (|
                                                M.alloc (| Value.Tuple [] |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ :=
                                                        M.use
                                                          (M.alloc (|
                                                            BinOp.Pure.ne
                                                              (M.read (| expected_maximum_fee |))
                                                              (M.read (| proof_maximum_fee |))
                                                          |)) in
                                                      let _ :=
                                                        M.is_constant_or_break_match (|
                                                          M.read (| γ |),
                                                          Value.Bool true
                                                        |) in
                                                      M.alloc (|
                                                        M.never_to_any (|
                                                          M.read (|
                                                            M.return_ (|
                                                              Value.StructTuple
                                                                "core::result::Result::Err"
                                                                [
                                                                  Value.StructTuple
                                                                    "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                    []
                                                                ]
                                                            |)
                                                          |)
                                                        |)
                                                      |)));
                                                  fun γ =>
                                                    ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                                ]
                                              |) in
                                            M.match_operator (|
                                              fee_ciphertext_validity_proof_context,
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ := M.read (| γ |) in
                                                    let γ1_0 :=
                                                      M.SubPointer.get_struct_record_field (|
                                                        γ,
                                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                                        "destination_pubkey"
                                                      |) in
                                                    let γ1_1 :=
                                                      M.SubPointer.get_struct_record_field (|
                                                        γ,
                                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                                        "auditor_pubkey"
                                                      |) in
                                                    let γ1_2 :=
                                                      M.SubPointer.get_struct_record_field (|
                                                        γ,
                                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                                        "grouped_ciphertext_lo"
                                                      |) in
                                                    let γ1_3 :=
                                                      M.SubPointer.get_struct_record_field (|
                                                        γ,
                                                        "solana_zk_token_sdk::instruction::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProofContext",
                                                        "grouped_ciphertext_hi"
                                                      |) in
                                                    let
                                                          destination_pubkey_from_transfer_fee_validity_proof :=
                                                      M.alloc (| γ1_0 |) in
                                                    let withdraw_withheld_authority_pubkey :=
                                                      M.alloc (| γ1_1 |) in
                                                    let fee_ciphertext_lo := M.alloc (| γ1_2 |) in
                                                    let fee_ciphertext_hi := M.alloc (| γ1_3 |) in
                                                    let _ :=
                                                      M.match_operator (|
                                                        M.alloc (| Value.Tuple [] |),
                                                        [
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ :=
                                                                M.use
                                                                  (M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::cmp::PartialEq",
                                                                        Ty.apply
                                                                          (Ty.path "&")
                                                                          [
                                                                            Ty.path
                                                                              "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey"
                                                                          ],
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path "&")
                                                                            [
                                                                              Ty.path
                                                                                "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::ElGamalPubkey"
                                                                            ]
                                                                        ],
                                                                        "ne",
                                                                        []
                                                                      |),
                                                                      [
                                                                        destination_pubkey;
                                                                        destination_pubkey_from_transfer_fee_validity_proof
                                                                      ]
                                                                    |)
                                                                  |)) in
                                                              let _ :=
                                                                M.is_constant_or_break_match (|
                                                                  M.read (| γ |),
                                                                  Value.Bool true
                                                                |) in
                                                              M.alloc (|
                                                                M.never_to_any (|
                                                                  M.read (|
                                                                    M.return_ (|
                                                                      Value.StructTuple
                                                                        "core::result::Result::Err"
                                                                        [
                                                                          Value.StructTuple
                                                                            "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                            []
                                                                        ]
                                                                    |)
                                                                  |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (M.alloc (| Value.Tuple [] |)))
                                                        ]
                                                      |) in
                                                    M.match_operator (|
                                                      range_proof_context,
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let γ := M.read (| γ |) in
                                                            let γ1_0 :=
                                                              M.SubPointer.get_struct_record_field (|
                                                                γ,
                                                                "solana_zk_token_sdk::instruction::batched_range_proof::BatchedRangeProofContext",
                                                                "commitments"
                                                              |) in
                                                            let γ1_1 :=
                                                              M.SubPointer.get_struct_record_field (|
                                                                γ,
                                                                "solana_zk_token_sdk::instruction::batched_range_proof::BatchedRangeProofContext",
                                                                "bit_lengths"
                                                              |) in
                                                            let range_proof_commitments :=
                                                              M.alloc (| γ1_0 |) in
                                                            let range_proof_bit_lengths :=
                                                              M.alloc (| γ1_1 |) in
                                                            let transfer_amount_commitment_lo :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::extract_commitment_from_grouped_ciphertext",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (|
                                                                      transfer_amount_ciphertext_lo
                                                                    |)
                                                                  ]
                                                                |)
                                                              |) in
                                                            let transfer_amount_commitment_hi :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::extract_commitment_from_grouped_ciphertext",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (|
                                                                      transfer_amount_ciphertext_hi
                                                                    |)
                                                                  ]
                                                                |)
                                                              |) in
                                                            let fee_commitment_lo :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::extract_commitment_from_grouped_ciphertext",
                                                                    []
                                                                  |),
                                                                  [ M.read (| fee_ciphertext_lo |) ]
                                                                |)
                                                              |) in
                                                            let fee_commitment_hi :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::extract_commitment_from_grouped_ciphertext",
                                                                    []
                                                                  |),
                                                                  [ M.read (| fee_ciphertext_hi |) ]
                                                                |)
                                                              |) in
                                                            let max_fee_basis_points_scalar :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::u64_to_scalar",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (|
                                                                      M.get_constant (|
                                                                        "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::MAX_FEE_BASIS_POINTS"
                                                                      |)
                                                                    |)
                                                                  ]
                                                                |)
                                                              |) in
                                                            let max_fee_basis_points_commitment :=
                                                              M.copy (|
                                                                M.match_operator (|
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::ops::try_trait::Try",
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::result::Result")
                                                                          [
                                                                            Ty.path
                                                                              "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                                                            Ty.path
                                                                              "spl_token_2022::error::TokenError"
                                                                          ],
                                                                        [],
                                                                        "branch",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::option::Option")
                                                                              [
                                                                                Ty.path
                                                                                  "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                              ],
                                                                            "ok_or",
                                                                            [
                                                                              Ty.path
                                                                                "spl_token_2022::error::TokenError"
                                                                            ]
                                                                          |),
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_function (|
                                                                                "solana_zk_token_sdk::curve25519::ristretto::target_arch::multiply_ristretto",
                                                                                []
                                                                              |),
                                                                              [
                                                                                max_fee_basis_points_scalar;
                                                                                M.get_constant (|
                                                                                  "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::G"
                                                                                |)
                                                                              ]
                                                                            |);
                                                                            Value.StructTuple
                                                                              "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                                                              []
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |),
                                                                  [
                                                                    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::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo";
                                                                                        Ty.path
                                                                                          "solana_program::program_error::ProgramError"
                                                                                      ],
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::result::Result")
                                                                                        [
                                                                                          Ty.path
                                                                                            "core::convert::Infallible";
                                                                                          Ty.path
                                                                                            "spl_token_2022::error::TokenError"
                                                                                        ]
                                                                                    ],
                                                                                    "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 claimed_complement_commitment :=
                                                              M.copy (|
                                                                M.match_operator (|
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::ops::try_trait::Try",
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::result::Result")
                                                                          [
                                                                            Ty.path
                                                                              "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                                                            Ty.path
                                                                              "spl_token_2022::error::TokenError"
                                                                          ],
                                                                        [],
                                                                        "branch",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::option::Option")
                                                                              [
                                                                                Ty.path
                                                                                  "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                              ],
                                                                            "ok_or",
                                                                            [
                                                                              Ty.path
                                                                                "spl_token_2022::error::TokenError"
                                                                            ]
                                                                          |),
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_function (|
                                                                                "solana_zk_token_sdk::curve25519::ristretto::target_arch::subtract_ristretto",
                                                                                []
                                                                              |),
                                                                              [
                                                                                max_fee_basis_points_commitment;
                                                                                M.alloc (|
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::convert::Into",
                                                                                      Ty.path
                                                                                        "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                                                                                      [
                                                                                        Ty.path
                                                                                          "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                                      ],
                                                                                      "into",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.read (|
                                                                                        M.read (|
                                                                                          claimed_commitment
                                                                                        |)
                                                                                      |)
                                                                                    ]
                                                                                  |)
                                                                                |)
                                                                              ]
                                                                            |);
                                                                            Value.StructTuple
                                                                              "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                                                              []
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |),
                                                                  [
                                                                    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::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo";
                                                                                        Ty.path
                                                                                          "solana_program::program_error::ProgramError"
                                                                                      ],
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::result::Result")
                                                                                        [
                                                                                          Ty.path
                                                                                            "core::convert::Infallible";
                                                                                          Ty.path
                                                                                            "spl_token_2022::error::TokenError"
                                                                                        ]
                                                                                    ],
                                                                                    "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 expected_commitments :=
                                                              M.alloc (|
                                                                Value.Array
                                                                  [
                                                                    M.read (|
                                                                      M.read (|
                                                                        new_source_commitment
                                                                      |)
                                                                    |);
                                                                    M.read (|
                                                                      transfer_amount_commitment_lo
                                                                    |);
                                                                    M.read (|
                                                                      transfer_amount_commitment_hi
                                                                    |);
                                                                    M.read (|
                                                                      M.read (|
                                                                        claimed_commitment
                                                                      |)
                                                                    |);
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::convert::Into",
                                                                        Ty.path
                                                                          "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint",
                                                                        [
                                                                          Ty.path
                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                        ],
                                                                        "into",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.read (|
                                                                          claimed_complement_commitment
                                                                        |)
                                                                      ]
                                                                    |);
                                                                    M.read (| fee_commitment_lo |);
                                                                    M.read (| fee_commitment_hi |)
                                                                  ]
                                                              |) in
                                                            let _ :=
                                                              M.match_operator (|
                                                                M.alloc (| Value.Tuple [] |),
                                                                [
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (let γ :=
                                                                        M.use
                                                                          (M.alloc (|
                                                                            UnOp.Pure.not
                                                                              (M.call_closure (|
                                                                                M.get_trait_method (|
                                                                                  "core::iter::traits::iterator::Iterator",
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "core::iter::adapters::zip::Zip")
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::slice::iter::Iter")
                                                                                        [
                                                                                          Ty.path
                                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                        ];
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::slice::iter::Iter")
                                                                                        [
                                                                                          Ty.path
                                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                        ]
                                                                                    ],
                                                                                  [],
                                                                                  "all",
                                                                                  [
                                                                                    Ty.function
                                                                                      [
                                                                                        Ty.tuple
                                                                                          [
                                                                                            Ty.tuple
                                                                                              [
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "&")
                                                                                                  [
                                                                                                    Ty.path
                                                                                                      "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                                  ];
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "&")
                                                                                                  [
                                                                                                    Ty.path
                                                                                                      "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                                  ]
                                                                                              ]
                                                                                          ]
                                                                                      ]
                                                                                      (Ty.path
                                                                                        "bool")
                                                                                  ]
                                                                                |),
                                                                                [
                                                                                  M.alloc (|
                                                                                    M.call_closure (|
                                                                                      M.get_trait_method (|
                                                                                        "core::iter::traits::iterator::Iterator",
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "core::slice::iter::Iter")
                                                                                          [
                                                                                            Ty.path
                                                                                              "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                          ],
                                                                                        [],
                                                                                        "zip",
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "core::slice::iter::Iter")
                                                                                            [
                                                                                              Ty.path
                                                                                                "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                            ]
                                                                                        ]
                                                                                      |),
                                                                                      [
                                                                                        M.call_closure (|
                                                                                          M.get_associated_function (|
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "slice")
                                                                                              [
                                                                                                Ty.path
                                                                                                  "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                              ],
                                                                                            "iter",
                                                                                            []
                                                                                          |),
                                                                                          [
                                                                                            (* Unsize *)
                                                                                            M.pointer_coercion
                                                                                              (M.read (|
                                                                                                range_proof_commitments
                                                                                              |))
                                                                                          ]
                                                                                        |);
                                                                                        M.call_closure (|
                                                                                          M.get_associated_function (|
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "slice")
                                                                                              [
                                                                                                Ty.path
                                                                                                  "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                              ],
                                                                                            "iter",
                                                                                            []
                                                                                          |),
                                                                                          [
                                                                                            (* Unsize *)
                                                                                            M.pointer_coercion
                                                                                              expected_commitments
                                                                                          ]
                                                                                        |)
                                                                                      ]
                                                                                    |)
                                                                                  |);
                                                                                  M.closure
                                                                                    (fun γ =>
                                                                                      ltac:(M.monadic
                                                                                        match γ with
                                                                                        | [ α0 ] =>
                                                                                          M.match_operator (|
                                                                                            M.alloc (|
                                                                                              α0
                                                                                            |),
                                                                                            [
                                                                                              fun
                                                                                                  γ =>
                                                                                                ltac:(M.monadic
                                                                                                  (let
                                                                                                        γ0_0 :=
                                                                                                    M.SubPointer.get_tuple_field (|
                                                                                                      γ,
                                                                                                      0
                                                                                                    |) in
                                                                                                  let
                                                                                                        γ0_1 :=
                                                                                                    M.SubPointer.get_tuple_field (|
                                                                                                      γ,
                                                                                                      1
                                                                                                    |) in
                                                                                                  let
                                                                                                        proof_commitment :=
                                                                                                    M.copy (|
                                                                                                      γ0_0
                                                                                                    |) in
                                                                                                  let
                                                                                                        expected_commitment :=
                                                                                                    M.copy (|
                                                                                                      γ0_1
                                                                                                    |) in
                                                                                                  M.call_closure (|
                                                                                                    M.get_trait_method (|
                                                                                                      "core::cmp::PartialEq",
                                                                                                      Ty.apply
                                                                                                        (Ty.path
                                                                                                          "&")
                                                                                                        [
                                                                                                          Ty.path
                                                                                                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                                        ],
                                                                                                      [
                                                                                                        Ty.apply
                                                                                                          (Ty.path
                                                                                                            "&")
                                                                                                          [
                                                                                                            Ty.path
                                                                                                              "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment"
                                                                                                          ]
                                                                                                      ],
                                                                                                      "eq",
                                                                                                      []
                                                                                                    |),
                                                                                                    [
                                                                                                      proof_commitment;
                                                                                                      expected_commitment
                                                                                                    ]
                                                                                                  |)))
                                                                                            ]
                                                                                          |)
                                                                                        | _ =>
                                                                                          M.impossible (||)
                                                                                        end))
                                                                                ]
                                                                              |))
                                                                          |)) in
                                                                      let _ :=
                                                                        M.is_constant_or_break_match (|
                                                                          M.read (| γ |),
                                                                          Value.Bool true
                                                                        |) in
                                                                      M.alloc (|
                                                                        M.never_to_any (|
                                                                          M.read (|
                                                                            M.return_ (|
                                                                              Value.StructTuple
                                                                                "core::result::Result::Err"
                                                                                [
                                                                                  Value.StructTuple
                                                                                    "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                                    []
                                                                                ]
                                                                            |)
                                                                          |)
                                                                        |)
                                                                      |)));
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (M.alloc (|
                                                                        Value.Tuple []
                                                                      |)))
                                                                ]
                                                              |) in
                                                            let expected_bit_lengths :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.apply
                                                                      (Ty.path "slice")
                                                                      [ Ty.path "u8" ],
                                                                    "iter",
                                                                    []
                                                                  |),
                                                                  [
                                                                    (* Unsize *)
                                                                    M.pointer_coercion
                                                                      (M.alloc (|
                                                                        Value.Array
                                                                          [
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::REMAINING_BALANCE_BIT_LENGTH"
                                                                              |)
                                                                            |);
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::TRANSFER_AMOUNT_LO_BIT_LENGTH"
                                                                              |)
                                                                            |);
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::TRANSFER_AMOUNT_HI_BIT_LENGTH"
                                                                              |)
                                                                            |);
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::DELTA_BIT_LENGTH"
                                                                              |)
                                                                            |);
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::DELTA_BIT_LENGTH"
                                                                              |)
                                                                            |);
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::FEE_AMOUNT_LO_BIT_LENGTH"
                                                                              |)
                                                                            |);
                                                                            M.read (|
                                                                              M.get_constant (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_and_extract::FEE_AMOUNT_HI_BIT_LENGTH"
                                                                              |)
                                                                            |)
                                                                          ]
                                                                      |))
                                                                  ]
                                                                |)
                                                              |) in
                                                            let _ :=
                                                              M.match_operator (|
                                                                M.alloc (| Value.Tuple [] |),
                                                                [
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (let γ :=
                                                                        M.use
                                                                          (M.alloc (|
                                                                            UnOp.Pure.not
                                                                              (M.call_closure (|
                                                                                M.get_trait_method (|
                                                                                  "core::iter::traits::iterator::Iterator",
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "core::iter::adapters::zip::Zip")
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::slice::iter::Iter")
                                                                                        [
                                                                                          Ty.path
                                                                                            "u8"
                                                                                        ];
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::slice::iter::Iter")
                                                                                        [
                                                                                          Ty.path
                                                                                            "u8"
                                                                                        ]
                                                                                    ],
                                                                                  [],
                                                                                  "all",
                                                                                  [
                                                                                    Ty.function
                                                                                      [
                                                                                        Ty.tuple
                                                                                          [
                                                                                            Ty.tuple
                                                                                              [
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "&")
                                                                                                  [
                                                                                                    Ty.path
                                                                                                      "u8"
                                                                                                  ];
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "&")
                                                                                                  [
                                                                                                    Ty.path
                                                                                                      "u8"
                                                                                                  ]
                                                                                              ]
                                                                                          ]
                                                                                      ]
                                                                                      (Ty.path
                                                                                        "bool")
                                                                                  ]
                                                                                |),
                                                                                [
                                                                                  M.alloc (|
                                                                                    M.call_closure (|
                                                                                      M.get_trait_method (|
                                                                                        "core::iter::traits::iterator::Iterator",
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "core::slice::iter::Iter")
                                                                                          [
                                                                                            Ty.path
                                                                                              "u8"
                                                                                          ],
                                                                                        [],
                                                                                        "zip",
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "core::slice::iter::Iter")
                                                                                            [
                                                                                              Ty.path
                                                                                                "u8"
                                                                                            ]
                                                                                        ]
                                                                                      |),
                                                                                      [
                                                                                        M.call_closure (|
                                                                                          M.get_associated_function (|
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "slice")
                                                                                              [
                                                                                                Ty.path
                                                                                                  "u8"
                                                                                              ],
                                                                                            "iter",
                                                                                            []
                                                                                          |),
                                                                                          [
                                                                                            (* Unsize *)
                                                                                            M.pointer_coercion
                                                                                              (M.read (|
                                                                                                range_proof_bit_lengths
                                                                                              |))
                                                                                          ]
                                                                                        |);
                                                                                        M.read (|
                                                                                          expected_bit_lengths
                                                                                        |)
                                                                                      ]
                                                                                    |)
                                                                                  |);
                                                                                  M.closure
                                                                                    (fun γ =>
                                                                                      ltac:(M.monadic
                                                                                        match γ with
                                                                                        | [ α0 ] =>
                                                                                          M.match_operator (|
                                                                                            M.alloc (|
                                                                                              α0
                                                                                            |),
                                                                                            [
                                                                                              fun
                                                                                                  γ =>
                                                                                                ltac:(M.monadic
                                                                                                  (let
                                                                                                        γ0_0 :=
                                                                                                    M.SubPointer.get_tuple_field (|
                                                                                                      γ,
                                                                                                      0
                                                                                                    |) in
                                                                                                  let
                                                                                                        γ0_1 :=
                                                                                                    M.SubPointer.get_tuple_field (|
                                                                                                      γ,
                                                                                                      1
                                                                                                    |) in
                                                                                                  let
                                                                                                        proof_len :=
                                                                                                    M.copy (|
                                                                                                      γ0_0
                                                                                                    |) in
                                                                                                  let
                                                                                                        expected_len :=
                                                                                                    M.copy (|
                                                                                                      γ0_1
                                                                                                    |) in
                                                                                                  M.call_closure (|
                                                                                                    M.get_trait_method (|
                                                                                                      "core::cmp::PartialEq",
                                                                                                      Ty.apply
                                                                                                        (Ty.path
                                                                                                          "&")
                                                                                                        [
                                                                                                          Ty.path
                                                                                                            "u8"
                                                                                                        ],
                                                                                                      [
                                                                                                        Ty.apply
                                                                                                          (Ty.path
                                                                                                            "&")
                                                                                                          [
                                                                                                            Ty.path
                                                                                                              "u8"
                                                                                                          ]
                                                                                                      ],
                                                                                                      "eq",
                                                                                                      []
                                                                                                    |),
                                                                                                    [
                                                                                                      proof_len;
                                                                                                      expected_len
                                                                                                    ]
                                                                                                  |)))
                                                                                            ]
                                                                                          |)
                                                                                        | _ =>
                                                                                          M.impossible (||)
                                                                                        end))
                                                                                ]
                                                                              |))
                                                                          |)) in
                                                                      let _ :=
                                                                        M.is_constant_or_break_match (|
                                                                          M.read (| γ |),
                                                                          Value.Bool true
                                                                        |) in
                                                                      M.alloc (|
                                                                        M.never_to_any (|
                                                                          M.read (|
                                                                            M.return_ (|
                                                                              Value.StructTuple
                                                                                "core::result::Result::Err"
                                                                                [
                                                                                  Value.StructTuple
                                                                                    "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                                    []
                                                                                ]
                                                                            |)
                                                                          |)
                                                                        |)
                                                                      |)));
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (M.alloc (|
                                                                        Value.Tuple []
                                                                      |)))
                                                                ]
                                                              |) in
                                                            let sigma_proof_fee_commitment_point :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "core::convert::Into",
                                                                    Ty.path
                                                                      "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                                                                    [
                                                                      Ty.path
                                                                        "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                    ],
                                                                    "into",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (|
                                                                      M.read (| fee_commitment |)
                                                                    |)
                                                                  ]
                                                                |)
                                                              |) in
                                                            let validity_proof_fee_point :=
                                                              M.copy (|
                                                                M.match_operator (|
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::ops::try_trait::Try",
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::result::Result")
                                                                          [
                                                                            Ty.path
                                                                              "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                                                            Ty.path
                                                                              "spl_token_2022::error::TokenError"
                                                                          ],
                                                                        [],
                                                                        "branch",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::option::Option")
                                                                              [
                                                                                Ty.path
                                                                                  "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                              ],
                                                                            "ok_or",
                                                                            [
                                                                              Ty.path
                                                                                "spl_token_2022::error::TokenError"
                                                                            ]
                                                                          |),
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_function (|
                                                                                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::combine_lo_hi_pedersen_points",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.alloc (|
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::convert::Into",
                                                                                      Ty.path
                                                                                        "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                                                                                      [
                                                                                        Ty.path
                                                                                          "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                                      ],
                                                                                      "into",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.read (|
                                                                                        fee_commitment_lo
                                                                                      |)
                                                                                    ]
                                                                                  |)
                                                                                |);
                                                                                M.alloc (|
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::convert::Into",
                                                                                      Ty.path
                                                                                        "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                                                                                      [
                                                                                        Ty.path
                                                                                          "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                                      ],
                                                                                      "into",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.read (|
                                                                                        fee_commitment_hi
                                                                                      |)
                                                                                    ]
                                                                                  |)
                                                                                |)
                                                                              ]
                                                                            |);
                                                                            Value.StructTuple
                                                                              "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                                                              []
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |),
                                                                  [
                                                                    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::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo";
                                                                                        Ty.path
                                                                                          "solana_program::program_error::ProgramError"
                                                                                      ],
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::result::Result")
                                                                                        [
                                                                                          Ty.path
                                                                                            "core::convert::Infallible";
                                                                                          Ty.path
                                                                                            "spl_token_2022::error::TokenError"
                                                                                        ]
                                                                                    ],
                                                                                    "from_residual",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    M.read (|
                                                                                      residual
                                                                                    |)
                                                                                  ]
                                                                                |)
                                                                              |)
                                                                            |)
                                                                          |)
                                                                        |)));
                                                                    fun γ =>
                                                                      ltac:(M.monadic
                                                                        (let γ0_0 :=
                                                                          M.SubPointer.get_struct_tuple_field (|
                                                                            γ,
                                                                            "core::ops::control_flow::ControlFlow::Continue",
                                                                            0
                                                                          |) in
                                                                        let val :=
                                                                          M.copy (| γ0_0 |) in
                                                                        val))
                                                                  ]
                                                                |)
                                                              |) in
                                                            let _ :=
                                                              M.match_operator (|
                                                                M.alloc (| Value.Tuple [] |),
                                                                [
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (let γ :=
                                                                        M.use
                                                                          (M.alloc (|
                                                                            M.call_closure (|
                                                                              M.get_trait_method (|
                                                                                "core::cmp::PartialEq",
                                                                                Ty.path
                                                                                  "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint",
                                                                                [
                                                                                  Ty.path
                                                                                    "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                                                                ],
                                                                                "ne",
                                                                                []
                                                                              |),
                                                                              [
                                                                                validity_proof_fee_point;
                                                                                sigma_proof_fee_commitment_point
                                                                              ]
                                                                            |)
                                                                          |)) in
                                                                      let _ :=
                                                                        M.is_constant_or_break_match (|
                                                                          M.read (| γ |),
                                                                          Value.Bool true
                                                                        |) in
                                                                      M.alloc (|
                                                                        M.never_to_any (|
                                                                          M.read (|
                                                                            M.return_ (|
                                                                              Value.StructTuple
                                                                                "core::result::Result::Err"
                                                                                [
                                                                                  Value.StructTuple
                                                                                    "solana_program::program_error::ProgramError::InvalidInstructionData"
                                                                                    []
                                                                                ]
                                                                            |)
                                                                          |)
                                                                        |)
                                                                      |)));
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (M.alloc (|
                                                                        Value.Tuple []
                                                                      |)))
                                                                ]
                                                              |) in
                                                            let _ :=
                                                              M.match_operator (|
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::try_trait::Try",
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::result::Result")
                                                                        [
                                                                          Ty.tuple [];
                                                                          Ty.path
                                                                            "solana_program::program_error::ProgramError"
                                                                        ],
                                                                      [],
                                                                      "branch",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_function (|
                                                                          "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_delta_commitment",
                                                                          []
                                                                        |),
                                                                        [
                                                                          transfer_amount_commitment_lo;
                                                                          transfer_amount_commitment_hi;
                                                                          M.read (|
                                                                            fee_commitment
                                                                          |);
                                                                          M.read (|
                                                                            delta_commitment
                                                                          |);
                                                                          M.call_closure (|
                                                                            M.get_trait_method (|
                                                                              "core::convert::Into",
                                                                              Ty.path
                                                                                "spl_pod::primitives::PodU16",
                                                                              [ Ty.path "u16" ],
                                                                              "into",
                                                                              []
                                                                            |),
                                                                            [
                                                                              M.read (|
                                                                                M.SubPointer.get_struct_record_field (|
                                                                                  M.read (|
                                                                                    fee_parameters
                                                                                  |),
                                                                                  "spl_token_2022::extension::transfer_fee::TransferFee",
                                                                                  "transfer_fee_basis_points"
                                                                                |)
                                                                              |)
                                                                            ]
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                |),
                                                                [
                                                                  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::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo";
                                                                                      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 transfer_with_fee_pubkeys :=
                                                              M.alloc (|
                                                                Value.StructRecord
                                                                  "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeePubkeysInfo"
                                                                  [
                                                                    ("source",
                                                                      M.read (|
                                                                        M.read (| source_pubkey |)
                                                                      |));
                                                                    ("destination",
                                                                      M.read (|
                                                                        M.read (|
                                                                          destination_pubkey
                                                                        |)
                                                                      |));
                                                                    ("auditor",
                                                                      M.read (|
                                                                        M.read (| auditor_pubkey |)
                                                                      |));
                                                                    ("withdraw_withheld_authority",
                                                                      M.read (|
                                                                        M.read (|
                                                                          withdraw_withheld_authority_pubkey
                                                                        |)
                                                                      |))
                                                                  ]
                                                              |) in
                                                            let transfer_amount_ciphertext_lo :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::transfer_amount_encryption_from_decrypt_handle",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (|
                                                                        source_decrypt_handles
                                                                      |),
                                                                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                                                                      "lo"
                                                                    |);
                                                                    M.read (|
                                                                      transfer_amount_ciphertext_lo
                                                                    |)
                                                                  ]
                                                                |)
                                                              |) in
                                                            let transfer_amount_ciphertext_hi :=
                                                              M.alloc (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::transfer_amount_encryption_from_decrypt_handle",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (|
                                                                        source_decrypt_handles
                                                                      |),
                                                                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                                                                      "hi"
                                                                    |);
                                                                    M.read (|
                                                                      transfer_amount_ciphertext_hi
                                                                    |)
                                                                  ]
                                                                |)
                                                              |) in
                                                            M.alloc (|
                                                              Value.StructTuple
                                                                "core::result::Result::Ok"
                                                                [
                                                                  Value.StructRecord
                                                                    "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::TransferWithFeeProofContextInfo"
                                                                    [
                                                                      ("ciphertext_lo",
                                                                        M.read (|
                                                                          transfer_amount_ciphertext_lo
                                                                        |));
                                                                      ("ciphertext_hi",
                                                                        M.read (|
                                                                          transfer_amount_ciphertext_hi
                                                                        |));
                                                                      ("transfer_with_fee_pubkeys",
                                                                        M.read (|
                                                                          transfer_with_fee_pubkeys
                                                                        |));
                                                                      ("new_source_ciphertext",
                                                                        M.read (|
                                                                          M.read (|
                                                                            new_source_ciphertext
                                                                          |)
                                                                        |));
                                                                      ("fee_ciphertext_lo",
                                                                        Value.StructTuple
                                                                          "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::FeeEncryption"
                                                                          [
                                                                            M.read (|
                                                                              M.read (|
                                                                                fee_ciphertext_lo
                                                                              |)
                                                                            |)
                                                                          ]);
                                                                      ("fee_ciphertext_hi",
                                                                        Value.StructTuple
                                                                          "solana_zk_token_sdk::zk_token_elgamal::pod::instruction::FeeEncryption"
                                                                          [
                                                                            M.read (|
                                                                              M.read (|
                                                                                fee_ciphertext_hi
                                                                              |)
                                                                            |)
                                                                          ])
                                                                    ]
                                                                ]
                                                            |)))
                                                      ]
                                                    |)))
                                              ]
                                            |)))
                                      ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)
                  |)))
              |)))
          | _, _ => M.impossible
          end.
        
        Axiom AssociatedFunction_verify_and_extract :
          M.IsAssociatedFunction Self "verify_and_extract" verify_and_extract.
      End Impl_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_TransferWithFeeProofContextInfo.
      
      (* StructRecord
        {
          name := "SourceDecryptHandles";
          ty_params := [];
          fields :=
            [
              ("lo", Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle");
              ("hi", Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle")
            ];
        } *)
      
      Module Impl_core_clone_Clone_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        (* 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.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_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_core_marker_Copy_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        Axiom Implements :
          M.IsTraitInstance
            "core::marker::Copy"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_marker_Copy_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_core_fmt_Debug_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        (* 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_field2_finish",
                  []
                |),
                [
                  M.read (| f |);
                  M.read (| Value.String "SourceDecryptHandles" |);
                  M.read (| Value.String "lo" |);
                  (* Unsize *)
                  M.pointer_coercion
                    (M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                      "lo"
                    |));
                  M.read (| Value.String "hi" |);
                  (* Unsize *)
                  M.pointer_coercion
                    (M.alloc (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                        "hi"
                      |)
                    |))
                ]
              |)))
          | _, _ => 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_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_core_default_Default_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        (* Default *)
        Definition default (τ : list Ty.t) (α : list Value.t) : M :=
          match τ, α with
          | [], [] =>
            ltac:(M.monadic
              (Value.StructRecord
                "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles"
                [
                  ("lo",
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::default::Default",
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle",
                        [],
                        "default",
                        []
                      |),
                      []
                    |));
                  ("hi",
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::default::Default",
                        Ty.path
                          "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle",
                        [],
                        "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_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_core_marker_StructuralPartialEq_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        Axiom Implements :
          M.IsTraitInstance
            "core::marker::StructuralPartialEq"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_marker_StructuralPartialEq_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_core_cmp_PartialEq_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        (* 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 (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::cmp::PartialEq",
                    Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle",
                    [ Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle"
                    ],
                    "eq",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                      "lo"
                    |);
                    M.SubPointer.get_struct_record_field (|
                      M.read (| other |),
                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                      "lo"
                    |)
                  ]
                |),
                ltac:(M.monadic
                  (M.call_closure (|
                    M.get_trait_method (|
                      "core::cmp::PartialEq",
                      Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle",
                      [ Ty.path "solana_zk_token_sdk::zk_token_elgamal::pod::elgamal::DecryptHandle"
                      ],
                      "eq",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                        "hi"
                      |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| other |),
                        "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles",
                        "hi"
                      |)
                    ]
                  |)))
              |)))
          | _, _ => 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_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_bytemuck_pod_Pod_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        Axiom Implements :
          M.IsTraitInstance
            "bytemuck::pod::Pod"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_bytemuck_pod_Pod_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Module Impl_bytemuck_zeroable_Zeroable_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
        Definition Self : Ty.t :=
          Ty.path
            "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::SourceDecryptHandles".
        
        Axiom Implements :
          M.IsTraitInstance
            "bytemuck::zeroable::Zeroable"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_bytemuck_zeroable_Zeroable_for_spl_token_2022_extension_confidential_transfer_ciphertext_extraction_SourceDecryptHandles.
      
      Definition value_G : Value.t :=
        M.run
          ltac:(M.monadic
            (M.alloc (|
              Value.StructTuple
                "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                [
                  Value.Array
                    [
                      Value.Integer 226;
                      Value.Integer 242;
                      Value.Integer 174;
                      Value.Integer 10;
                      Value.Integer 106;
                      Value.Integer 188;
                      Value.Integer 78;
                      Value.Integer 113;
                      Value.Integer 168;
                      Value.Integer 132;
                      Value.Integer 169;
                      Value.Integer 97;
                      Value.Integer 197;
                      Value.Integer 0;
                      Value.Integer 81;
                      Value.Integer 95;
                      Value.Integer 88;
                      Value.Integer 227;
                      Value.Integer 11;
                      Value.Integer 106;
                      Value.Integer 165;
                      Value.Integer 130;
                      Value.Integer 221;
                      Value.Integer 141;
                      Value.Integer 182;
                      Value.Integer 166;
                      Value.Integer 89;
                      Value.Integer 69;
                      Value.Integer 224;
                      Value.Integer 141;
                      Value.Integer 45;
                      Value.Integer 118
                    ]
                ]
            |))).
      
      (*
      fn u16_to_scalar(amount: u16) -> PodScalar {
          let mut bytes = [0u8; 32];
          bytes[..2].copy_from_slice(&amount.to_le_bytes());
          PodScalar(bytes)
      }
      *)
      Definition u16_to_scalar (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [], [ amount ] =>
          ltac:(M.monadic
            (let amount := M.alloc (| amount |) in
            M.read (|
              let bytes := M.alloc (| repeat (Value.Integer 0) 32 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 2) ]
                        ]
                      |);
                      (* Unsize *)
                      M.pointer_coercion
                        (M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (| Ty.path "u16", "to_le_bytes", [] |),
                            [ M.read (| amount |) ]
                          |)
                        |))
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::curve25519::scalar::PodScalar"
                  [ M.read (| bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      fn u64_to_scalar(amount: u64) -> PodScalar {
          let mut bytes = [0u8; 32];
          bytes[..8].copy_from_slice(&amount.to_le_bytes());
          PodScalar(bytes)
      }
      *)
      Definition u64_to_scalar (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [], [ amount ] =>
          ltac:(M.monadic
            (let amount := M.alloc (| amount |) in
            M.read (|
              let bytes := M.alloc (| repeat (Value.Integer 0) 32 |) in
              let _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [ Ty.path "u8" ],
                      "copy_from_slice",
                      []
                    |),
                    [
                      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::RangeTo") [ Ty.path "usize" ] ],
                          "index_mut",
                          []
                        |),
                        [
                          bytes;
                          Value.StructRecord
                            "core::ops::range::RangeTo"
                            [ ("end_", Value.Integer 8) ]
                        ]
                      |);
                      (* Unsize *)
                      M.pointer_coercion
                        (M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (| Ty.path "u64", "to_le_bytes", [] |),
                            [ M.read (| amount |) ]
                          |)
                        |))
                    ]
                  |)
                |) in
              M.alloc (|
                Value.StructTuple
                  "solana_zk_token_sdk::curve25519::scalar::PodScalar"
                  [ M.read (| bytes |) ]
              |)
            |)))
        | _, _ => M.impossible
        end.
      
      (*
      fn combine_lo_hi_pedersen_points(
          point_lo: &PodRistrettoPoint,
          point_hi: &PodRistrettoPoint,
      ) -> Option<PodRistrettoPoint> {
          const SCALING_CONSTANT: u64 = 65536;
          let scaling_constant_scalar = u64_to_scalar(SCALING_CONSTANT);
          let scaled_point_hi = ristretto::multiply_ristretto(&scaling_constant_scalar, point_hi)?;
          ristretto::add_ristretto(point_lo, &scaled_point_hi)
      }
      *)
      Definition combine_lo_hi_pedersen_points (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [], [ point_lo; point_hi ] =>
          ltac:(M.monadic
            (let point_lo := M.alloc (| point_lo |) in
            let point_hi := M.alloc (| point_hi |) in
            M.catch_return (|
              ltac:(M.monadic
                (M.read (|
                  let scaling_constant_scalar :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_function (|
                          "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::u64_to_scalar",
                          []
                        |),
                        [
                          M.read (|
                            M.get_constant (|
                              "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::combine_lo_hi_pedersen_points::SCALING_CONSTANT"
                            |)
                          |)
                        ]
                      |)
                    |) in
                  let scaled_point_hi :=
                    M.copy (|
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply
                                (Ty.path "core::option::Option")
                                [
                                  Ty.path
                                    "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_function (|
                                  "solana_zk_token_sdk::curve25519::ristretto::target_arch::multiply_ristretto",
                                  []
                                |),
                                [ scaling_constant_scalar; M.read (| point_hi |) ]
                              |)
                            ]
                          |)
                        |),
                        [
                          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::option::Option")
                                            [
                                              Ty.path
                                                "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                            ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::option::Option")
                                              [ Ty.path "core::convert::Infallible" ]
                                          ],
                                          "from_residual",
                                          []
                                        |),
                                        [ M.read (| residual |) ]
                                      |)
                                    |)
                                  |)
                                |)
                              |)));
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Continue",
                                  0
                                |) in
                              let val := M.copy (| γ0_0 |) in
                              val))
                        ]
                      |)
                    |) in
                  M.alloc (|
                    M.call_closure (|
                      M.get_function (|
                        "solana_zk_token_sdk::curve25519::ristretto::target_arch::add_ristretto",
                        []
                      |),
                      [ M.read (| point_lo |); scaled_point_hi ]
                    |)
                  |)
                |)))
            |)))
        | _, _ => M.impossible
        end.
      
      Module combine_lo_hi_pedersen_points.
        Definition value_SCALING_CONSTANT : Value.t :=
          M.run ltac:(M.monadic (M.alloc (| Value.Integer 65536 |))).
      End combine_lo_hi_pedersen_points.
      
      (*
      fn verify_delta_commitment(
          transfer_amount_commitment_lo: &PedersenCommitment,
          transfer_amount_commitment_hi: &PedersenCommitment,
          fee_commitment: &PedersenCommitment,
          proof_delta_commitment: &PedersenCommitment,
          transfer_fee_basis_points: u16,
      ) -> Result<(), ProgramError> {
          let transfer_amount_point = combine_lo_hi_pedersen_points(
              &( *transfer_amount_commitment_lo).into(),
              &( *transfer_amount_commitment_hi).into(),
          )
          .ok_or(TokenError::CiphertextArithmeticFailed)?;
          let transfer_fee_basis_points_scalar = u16_to_scalar(transfer_fee_basis_points);
          let scaled_transfer_amount_point =
              ristretto::multiply_ristretto(&transfer_fee_basis_points_scalar, &transfer_amount_point)
                  .ok_or(TokenError::CiphertextArithmeticFailed)?;
      
          const MAX_FEE_BASIS_POINTS: u64 = 10_000;
          let max_fee_basis_points_scalar = u64_to_scalar(MAX_FEE_BASIS_POINTS);
          let fee_point: PodRistrettoPoint = ( *fee_commitment).into();
          let scaled_fee_point = ristretto::multiply_ristretto(&max_fee_basis_points_scalar, &fee_point)
              .ok_or(TokenError::CiphertextArithmeticFailed)?;
      
          let expected_delta_commitment_point =
              ristretto::subtract_ristretto(&scaled_fee_point, &scaled_transfer_amount_point)
                  .ok_or(TokenError::CiphertextArithmeticFailed)?;
      
          let proof_delta_commitment_point = ( *proof_delta_commitment).into();
          if expected_delta_commitment_point != proof_delta_commitment_point {
              return Err(ProgramError::InvalidInstructionData);
          }
          Ok(())
      }
      *)
      Definition verify_delta_commitment (τ : list Ty.t) (α : list Value.t) : M :=
        match τ, α with
        | [],
            [
              transfer_amount_commitment_lo;
              transfer_amount_commitment_hi;
              fee_commitment;
              proof_delta_commitment;
              transfer_fee_basis_points
            ] =>
          ltac:(M.monadic
            (let transfer_amount_commitment_lo := M.alloc (| transfer_amount_commitment_lo |) in
            let transfer_amount_commitment_hi := M.alloc (| transfer_amount_commitment_hi |) in
            let fee_commitment := M.alloc (| fee_commitment |) in
            let proof_delta_commitment := M.alloc (| proof_delta_commitment |) in
            let transfer_fee_basis_points := M.alloc (| transfer_fee_basis_points |) in
            M.catch_return (|
              ltac:(M.monadic
                (M.read (|
                  let transfer_amount_point :=
                    M.copy (|
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply
                                (Ty.path "core::result::Result")
                                [
                                  Ty.path
                                    "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                  Ty.path "spl_token_2022::error::TokenError"
                                ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::option::Option")
                                    [
                                      Ty.path
                                        "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                    ],
                                  "ok_or",
                                  [ Ty.path "spl_token_2022::error::TokenError" ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::combine_lo_hi_pedersen_points",
                                      []
                                    |),
                                    [
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::convert::Into",
                                            Ty.path
                                              "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                                            [
                                              Ty.path
                                                "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                            ],
                                            "into",
                                            []
                                          |),
                                          [ M.read (| M.read (| transfer_amount_commitment_lo |) |)
                                          ]
                                        |)
                                      |);
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::convert::Into",
                                            Ty.path
                                              "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                                            [
                                              Ty.path
                                                "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                            ],
                                            "into",
                                            []
                                          |),
                                          [ M.read (| M.read (| transfer_amount_commitment_hi |) |)
                                          ]
                                        |)
                                      |)
                                    ]
                                  |);
                                  Value.StructTuple
                                    "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                    []
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Break",
                                  0
                                |) in
                              let residual := M.copy (| γ0_0 |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::FromResidual",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            [
                                              Ty.tuple [];
                                              Ty.path "solana_program::program_error::ProgramError"
                                            ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::result::Result")
                                              [
                                                Ty.path "core::convert::Infallible";
                                                Ty.path "spl_token_2022::error::TokenError"
                                              ]
                                          ],
                                          "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 transfer_fee_basis_points_scalar :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_function (|
                          "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::u16_to_scalar",
                          []
                        |),
                        [ M.read (| transfer_fee_basis_points |) ]
                      |)
                    |) in
                  let scaled_transfer_amount_point :=
                    M.copy (|
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply
                                (Ty.path "core::result::Result")
                                [
                                  Ty.path
                                    "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                  Ty.path "spl_token_2022::error::TokenError"
                                ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::option::Option")
                                    [
                                      Ty.path
                                        "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                    ],
                                  "ok_or",
                                  [ Ty.path "spl_token_2022::error::TokenError" ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "solana_zk_token_sdk::curve25519::ristretto::target_arch::multiply_ristretto",
                                      []
                                    |),
                                    [ transfer_fee_basis_points_scalar; transfer_amount_point ]
                                  |);
                                  Value.StructTuple
                                    "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                    []
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Break",
                                  0
                                |) in
                              let residual := M.copy (| γ0_0 |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::FromResidual",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            [
                                              Ty.tuple [];
                                              Ty.path "solana_program::program_error::ProgramError"
                                            ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::result::Result")
                                              [
                                                Ty.path "core::convert::Infallible";
                                                Ty.path "spl_token_2022::error::TokenError"
                                              ]
                                          ],
                                          "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 max_fee_basis_points_scalar :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_function (|
                          "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::u64_to_scalar",
                          []
                        |),
                        [
                          M.read (|
                            M.get_constant (|
                              "spl_token_2022::extension::confidential_transfer::ciphertext_extraction::verify_delta_commitment::MAX_FEE_BASIS_POINTS"
                            |)
                          |)
                        ]
                      |)
                    |) in
                  let fee_point :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::convert::Into",
                          Ty.path
                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                          [ Ty.path "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                          ],
                          "into",
                          []
                        |),
                        [ M.read (| M.read (| fee_commitment |) |) ]
                      |)
                    |) in
                  let scaled_fee_point :=
                    M.copy (|
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply
                                (Ty.path "core::result::Result")
                                [
                                  Ty.path
                                    "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                  Ty.path "spl_token_2022::error::TokenError"
                                ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::option::Option")
                                    [
                                      Ty.path
                                        "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                    ],
                                  "ok_or",
                                  [ Ty.path "spl_token_2022::error::TokenError" ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "solana_zk_token_sdk::curve25519::ristretto::target_arch::multiply_ristretto",
                                      []
                                    |),
                                    [ max_fee_basis_points_scalar; fee_point ]
                                  |);
                                  Value.StructTuple
                                    "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                    []
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Break",
                                  0
                                |) in
                              let residual := M.copy (| γ0_0 |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::FromResidual",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            [
                                              Ty.tuple [];
                                              Ty.path "solana_program::program_error::ProgramError"
                                            ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::result::Result")
                                              [
                                                Ty.path "core::convert::Infallible";
                                                Ty.path "spl_token_2022::error::TokenError"
                                              ]
                                          ],
                                          "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 expected_delta_commitment_point :=
                    M.copy (|
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply
                                (Ty.path "core::result::Result")
                                [
                                  Ty.path
                                    "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint";
                                  Ty.path "spl_token_2022::error::TokenError"
                                ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::option::Option")
                                    [
                                      Ty.path
                                        "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                    ],
                                  "ok_or",
                                  [ Ty.path "spl_token_2022::error::TokenError" ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_function (|
                                      "solana_zk_token_sdk::curve25519::ristretto::target_arch::subtract_ristretto",
                                      []
                                    |),
                                    [ scaled_fee_point; scaled_transfer_amount_point ]
                                  |);
                                  Value.StructTuple
                                    "spl_token_2022::error::TokenError::CiphertextArithmeticFailed"
                                    []
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Break",
                                  0
                                |) in
                              let residual := M.copy (| γ0_0 |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::FromResidual",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            [
                                              Ty.tuple [];
                                              Ty.path "solana_program::program_error::ProgramError"
                                            ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::result::Result")
                                              [
                                                Ty.path "core::convert::Infallible";
                                                Ty.path "spl_token_2022::error::TokenError"
                                              ]
                                          ],
                                          "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 proof_delta_commitment_point :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::convert::Into",
                          Ty.path
                            "solana_zk_token_sdk::zk_token_elgamal::pod::pedersen::PedersenCommitment",
                          [ Ty.path "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                          ],
                          "into",
                          []
                        |),
                        [ M.read (| M.read (| proof_delta_commitment |) |) ]
                      |)
                    |) in
                  let _ :=
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::cmp::PartialEq",
                                      Ty.path
                                        "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint",
                                      [
                                        Ty.path
                                          "solana_zk_token_sdk::curve25519::ristretto::PodRistrettoPoint"
                                      ],
                                      "ne",
                                      []
                                    |),
                                    [ expected_delta_commitment_point; proof_delta_commitment_point
                                    ]
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            M.alloc (|
                              M.never_to_any (|
                                M.read (|
                                  M.return_ (|
                                    Value.StructTuple
                                      "core::result::Result::Err"
                                      [
                                        Value.StructTuple
                                          "solana_program::program_error::ProgramError::InvalidInstructionData"
                                          []
                                      ]
                                  |)
                                |)
                              |)
                            |)));
                        fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                      ]
                    |) in
                  M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
                |)))
            |)))
        | _, _ => M.impossible
        end.
      
      Module verify_delta_commitment.
        Definition value_MAX_FEE_BASIS_POINTS : Value.t :=
          M.run ltac:(M.monadic (M.alloc (| Value.Integer 10000 |))).
      End verify_delta_commitment.
    End ciphertext_extraction.
  End confidential_transfer.
End extension.
