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

Module inspector.
  Module handler_register.
    (* Trait *)
    (* Empty module 'GetInspector' *)
    
    Module Impl_revm_inspector_handler_register_GetInspector_where_revm_primitives_db_Database_DB_where_revm_inspector_Inspector_INSP_DB_DB_for_INSP.
      Definition Self (DB INSP : Ty.t) : Ty.t := INSP.
      
      (*
          fn get_inspector(&mut self) -> &mut impl Inspector<DB> {
              self
          }
      *)
      Definition get_inspector
          (DB INSP : Ty.t)
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        let Self : Ty.t := Self DB INSP in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (| self |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (DB INSP : Ty.t),
        M.IsTraitInstance
          "revm::inspector::handler_register::GetInspector"
          (Self DB INSP)
          (* Trait polymorphic types *) [ (* DB *) DB ]
          (* Instance *) [ ("get_inspector", InstanceField.Method (get_inspector DB INSP)) ].
    End Impl_revm_inspector_handler_register_GetInspector_where_revm_primitives_db_Database_DB_where_revm_inspector_Inspector_INSP_DB_DB_for_INSP.
    
    (*
    pub fn inspector_handle_register<'a, DB: Database, EXT: GetInspector<DB>>(
        handler: &mut EvmHandler<'a, EXT, DB>,
    ) {
        // Every instruction inside flat table that is going to be wrapped by inspector calls.
        let table = handler
            .take_instruction_table()
            .expect("Handler must have instruction table");
        let mut table = match table {
            InstructionTables::Plain(table) => table
                .into_iter()
                .map(|i| inspector_instruction(i))
                .collect::<Vec<_>>(),
            InstructionTables::Boxed(table) => table
                .into_iter()
                .map(|i| inspector_instruction(i))
                .collect::<Vec<_>>(),
        };
    
        // Register inspector Log instruction.
        let mut inspect_log = |index: u8| {
            if let Some(i) = table.get_mut(index as usize) {
                let old = core::mem::replace(i, Box::new(|_, _| ()));
                *i = Box::new(
                    move |interpreter: &mut Interpreter, host: &mut Evm<'a, EXT, DB>| {
                        let old_log_len = host.context.evm.journaled_state.logs.len();
                        old(interpreter, host);
                        // check if log was added. It is possible that revert happened
                        // cause of gas or stack underflow.
                        if host.context.evm.journaled_state.logs.len() == old_log_len + 1 {
                            // clone log.
                            // TODO decide if we should remove this and leave the comment
                            // that log can be found as journaled_state.
                            let last_log = host
                                .context
                                .evm
                                .journaled_state
                                .logs
                                .last()
                                .unwrap()
                                .clone();
                            // call Inspector
                            host.context
                                .external
                                .get_inspector()
                                .log(&mut host.context.evm, &last_log);
                        }
                    },
                )
            }
        };
    
        inspect_log(opcode::LOG0);
        inspect_log(opcode::LOG1);
        inspect_log(opcode::LOG2);
        inspect_log(opcode::LOG3);
        inspect_log(opcode::LOG4);
    
        // // register selfdestruct function.
        if let Some(i) = table.get_mut(opcode::SELFDESTRUCT as usize) {
            let old = core::mem::replace(i, Box::new(|_, _| ()));
            *i = Box::new(
                move |interpreter: &mut Interpreter, host: &mut Evm<'a, EXT, DB>| {
                    // execute selfdestruct
                    old(interpreter, host);
                    // check if selfdestruct was successful and if journal entry is made.
                    if let Some(JournalEntry::AccountDestroyed {
                        address,
                        target,
                        had_balance,
                        ..
                    }) = host
                        .context
                        .evm
                        .journaled_state
                        .journal
                        .last()
                        .unwrap()
                        .last()
                    {
                        host.context.external.get_inspector().selfdestruct(
                            *address,
                            *target,
                            *had_balance,
                        );
                    }
                },
            )
        }
    
        // cast vector to array.
        handler.set_instruction_table(InstructionTables::Boxed(
            table.try_into().unwrap_or_else(|_| unreachable!()),
        ));
    
        // call and create input stack shared between handlers. They are used to share
        // inputs in *_end Inspector calls.
        let call_input_stack = Rc::<RefCell<Vec<_>>>::new(RefCell::new(Vec::new()));
        let create_input_stack = Rc::<RefCell<Vec<_>>>::new(RefCell::new(Vec::new()));
        let eofcreate_input_stack = Rc::<RefCell<Vec<_>>>::new(RefCell::new(Vec::new()));
    
        // Create handler
        let create_input_stack_inner = create_input_stack.clone();
        let old_handle = handler.execution.create.clone();
        handler.execution.create = Arc::new(
            move |ctx, mut inputs| -> Result<FrameOrResult, EVMError<DB::Error>> {
                let inspector = ctx.external.get_inspector();
                // call inspector create to change input or return outcome.
                if let Some(outcome) = inspector.create(&mut ctx.evm, &mut inputs) {
                    create_input_stack_inner.borrow_mut().push(inputs.clone());
                    return Ok(FrameOrResult::Result(FrameResult::Create(outcome)));
                }
                create_input_stack_inner.borrow_mut().push(inputs.clone());
    
                let mut frame_or_result = old_handle(ctx, inputs);
                if let Ok(FrameOrResult::Frame(frame)) = &mut frame_or_result {
                    ctx.external
                        .get_inspector()
                        .initialize_interp(frame.interpreter_mut(), &mut ctx.evm)
                }
                frame_or_result
            },
        );
    
        // Call handler
        let call_input_stack_inner = call_input_stack.clone();
        let old_handle = handler.execution.call.clone();
        handler.execution.call = Arc::new(
            move |ctx, mut inputs| -> Result<FrameOrResult, EVMError<DB::Error>> {
                // Call inspector to change input or return outcome.
                let outcome = ctx.external.get_inspector().call(&mut ctx.evm, &mut inputs);
                call_input_stack_inner.borrow_mut().push(inputs.clone());
                if let Some(outcome) = outcome {
                    return Ok(FrameOrResult::Result(FrameResult::Call(outcome)));
                }
    
                let mut frame_or_result = old_handle(ctx, inputs);
                if let Ok(FrameOrResult::Frame(frame)) = &mut frame_or_result {
                    ctx.external
                        .get_inspector()
                        .initialize_interp(frame.interpreter_mut(), &mut ctx.evm)
                }
                frame_or_result
            },
        );
    
        // TODO(EOF) EOF create call.
    
        // call outcome
        let call_input_stack_inner = call_input_stack.clone();
        let old_handle = handler.execution.insert_call_outcome.clone();
        handler.execution.insert_call_outcome =
            Arc::new(move |ctx, frame, shared_memory, mut outcome| {
                let call_inputs = call_input_stack_inner.borrow_mut().pop().unwrap();
                outcome = ctx
                    .external
                    .get_inspector()
                    .call_end(&mut ctx.evm, &call_inputs, outcome);
                old_handle(ctx, frame, shared_memory, outcome)
            });
    
        // create outcome
        let create_input_stack_inner = create_input_stack.clone();
        let old_handle = handler.execution.insert_create_outcome.clone();
        handler.execution.insert_create_outcome = Arc::new(move |ctx, frame, mut outcome| {
            let create_inputs = create_input_stack_inner.borrow_mut().pop().unwrap();
            outcome = ctx
                .external
                .get_inspector()
                .create_end(&mut ctx.evm, &create_inputs, outcome);
            old_handle(ctx, frame, outcome)
        });
    
        // TODO(EOF) EOF create handle.
    
        // last frame outcome
        let old_handle = handler.execution.last_frame_return.clone();
        handler.execution.last_frame_return = Arc::new(move |ctx, frame_result| {
            let inspector = ctx.external.get_inspector();
            match frame_result {
                FrameResult::Call(outcome) => {
                    let call_inputs = call_input_stack.borrow_mut().pop().unwrap();
                    *outcome = inspector.call_end(&mut ctx.evm, &call_inputs, outcome.clone());
                }
                FrameResult::Create(outcome) => {
                    let create_inputs = create_input_stack.borrow_mut().pop().unwrap();
                    *outcome = inspector.create_end(&mut ctx.evm, &create_inputs, outcome.clone());
                }
                FrameResult::EOFCreate(outcome) => {
                    let eofcreate_inputs = eofcreate_input_stack.borrow_mut().pop().unwrap();
                    *outcome =
                        inspector.eofcreate_end(&mut ctx.evm, &eofcreate_inputs, outcome.clone());
                }
            }
            old_handle(ctx, frame_result)
        });
    }
    *)
    Definition inspector_handle_register
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [ DB; EXT ], [ handler ] =>
        ltac:(M.monadic
          (let handler := M.alloc (| handler |) in
          M.read (|
            let~ table :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "core::option::Option")
                      []
                      [
                        Ty.apply
                          (Ty.path "revm_interpreter::opcode::InstructionTables")
                          []
                          [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ] ]
                      ],
                    "expect",
                    []
                  |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "revm::handler::Handler")
                          []
                          [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ]; EXT; DB ],
                        "take_instruction_table",
                        []
                      |),
                      [ M.read (| handler |) ]
                    |);
                    M.read (| Value.String "Handler must have instruction table" |)
                  ]
                |)
              |) in
            let~ table :=
              M.copy (|
                M.match_operator (|
                  table,
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "revm_interpreter::opcode::InstructionTables::Plain",
                            0
                          |) in
                        let table := M.copy (| γ0_0 |) in
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::iter::adapters::map::Map")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "core::array::iter::IntoIter")
                                    [ Value.Integer IntegerKind.Usize 256 ]
                                    [
                                      Ty.function
                                        [
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [ Ty.path "revm_interpreter::interpreter::Interpreter"
                                            ];
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ] ]
                                        ]
                                        (Ty.tuple [])
                                    ];
                                  Ty.function
                                    [
                                      Ty.tuple
                                        [
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [
                                                  Ty.path
                                                    "revm_interpreter::interpreter::Interpreter"
                                                ];
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ]
                                                ]
                                            ]
                                            (Ty.tuple [])
                                        ]
                                    ]
                                    (Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ])
                                ],
                              [],
                              "collect",
                              [
                                Ty.apply
                                  (Ty.path "alloc::vec::Vec")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ];
                                    Ty.path "alloc::alloc::Global"
                                  ]
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply
                                    (Ty.path "core::array::iter::IntoIter")
                                    [ Value.Integer IntegerKind.Usize 256 ]
                                    [
                                      Ty.function
                                        [
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [ Ty.path "revm_interpreter::interpreter::Interpreter"
                                            ];
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ] ]
                                        ]
                                        (Ty.tuple [])
                                    ],
                                  [],
                                  "map",
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ];
                                    Ty.function
                                      [
                                        Ty.tuple
                                          [
                                            Ty.function
                                              [
                                                Ty.apply
                                                  (Ty.path "&mut")
                                                  []
                                                  [
                                                    Ty.path
                                                      "revm_interpreter::interpreter::Interpreter"
                                                  ];
                                                Ty.apply
                                                  (Ty.path "&mut")
                                                  []
                                                  [
                                                    Ty.apply
                                                      (Ty.path "revm::evm::Evm")
                                                      []
                                                      [ EXT; DB ]
                                                  ]
                                              ]
                                              (Ty.tuple [])
                                          ]
                                      ]
                                      (Ty.apply
                                        (Ty.path "alloc::boxed::Box")
                                        []
                                        [
                                          Ty.dyn
                                            [
                                              ("existential predicate with variables", []);
                                              ("existential predicate with variables", [])
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ])
                                  ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::collect::IntoIterator",
                                      Ty.apply
                                        (Ty.path "array")
                                        [ Value.Integer IntegerKind.Usize 256 ]
                                        [
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [
                                                  Ty.path
                                                    "revm_interpreter::interpreter::Interpreter"
                                                ];
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ]
                                                ]
                                            ]
                                            (Ty.tuple [])
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| table |) ]
                                  |);
                                  M.closure
                                    (fun γ =>
                                      ltac:(M.monadic
                                        match γ with
                                        | [ α0 ] =>
                                          ltac:(M.monadic
                                            (M.match_operator (|
                                              M.alloc (| α0 |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let i := M.copy (| γ |) in
                                                    M.call_closure (|
                                                      M.get_function (|
                                                        "revm::inspector::handler_register::inspector_instruction",
                                                        [
                                                          EXT;
                                                          DB;
                                                          Ty.function
                                                            [
                                                              Ty.apply
                                                                (Ty.path "&mut")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "revm_interpreter::interpreter::Interpreter"
                                                                ];
                                                              Ty.apply
                                                                (Ty.path "&mut")
                                                                []
                                                                [
                                                                  Ty.apply
                                                                    (Ty.path "revm::evm::Evm")
                                                                    []
                                                                    [ EXT; DB ]
                                                                ]
                                                            ]
                                                            (Ty.tuple [])
                                                        ]
                                                      |),
                                                      [ M.read (| i |) ]
                                                    |)))
                                              ]
                                            |)))
                                        | _ => M.impossible "wrong number of arguments"
                                        end))
                                ]
                              |)
                            ]
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "revm_interpreter::opcode::InstructionTables::Boxed",
                            0
                          |) in
                        let table := M.copy (| γ0_0 |) in
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::iter::adapters::map::Map")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "core::array::iter::IntoIter")
                                    [ Value.Integer IntegerKind.Usize 256 ]
                                    [
                                      Ty.apply
                                        (Ty.path "alloc::boxed::Box")
                                        []
                                        [
                                          Ty.dyn
                                            [
                                              ("existential predicate with variables", []);
                                              ("existential predicate with variables", [])
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ]
                                    ];
                                  Ty.function
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "alloc::boxed::Box")
                                            []
                                            [
                                              Ty.dyn
                                                [
                                                  ("existential predicate with variables", []);
                                                  ("existential predicate with variables", [])
                                                ];
                                              Ty.path "alloc::alloc::Global"
                                            ]
                                        ]
                                    ]
                                    (Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ])
                                ],
                              [],
                              "collect",
                              [
                                Ty.apply
                                  (Ty.path "alloc::vec::Vec")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ];
                                    Ty.path "alloc::alloc::Global"
                                  ]
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply
                                    (Ty.path "core::array::iter::IntoIter")
                                    [ Value.Integer IntegerKind.Usize 256 ]
                                    [
                                      Ty.apply
                                        (Ty.path "alloc::boxed::Box")
                                        []
                                        [
                                          Ty.dyn
                                            [
                                              ("existential predicate with variables", []);
                                              ("existential predicate with variables", [])
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ]
                                    ],
                                  [],
                                  "map",
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ];
                                    Ty.function
                                      [
                                        Ty.tuple
                                          [
                                            Ty.apply
                                              (Ty.path "alloc::boxed::Box")
                                              []
                                              [
                                                Ty.dyn
                                                  [
                                                    ("existential predicate with variables", []);
                                                    ("existential predicate with variables", [])
                                                  ];
                                                Ty.path "alloc::alloc::Global"
                                              ]
                                          ]
                                      ]
                                      (Ty.apply
                                        (Ty.path "alloc::boxed::Box")
                                        []
                                        [
                                          Ty.dyn
                                            [
                                              ("existential predicate with variables", []);
                                              ("existential predicate with variables", [])
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ])
                                  ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::collect::IntoIterator",
                                      Ty.apply
                                        (Ty.path "array")
                                        [ Value.Integer IntegerKind.Usize 256 ]
                                        [
                                          Ty.apply
                                            (Ty.path "alloc::boxed::Box")
                                            []
                                            [
                                              Ty.dyn
                                                [
                                                  ("existential predicate with variables", []);
                                                  ("existential predicate with variables", [])
                                                ];
                                              Ty.path "alloc::alloc::Global"
                                            ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [ M.read (| table |) ]
                                  |);
                                  M.closure
                                    (fun γ =>
                                      ltac:(M.monadic
                                        match γ with
                                        | [ α0 ] =>
                                          ltac:(M.monadic
                                            (M.match_operator (|
                                              M.alloc (| α0 |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let i := M.copy (| γ |) in
                                                    M.call_closure (|
                                                      M.get_function (|
                                                        "revm::inspector::handler_register::inspector_instruction",
                                                        [
                                                          EXT;
                                                          DB;
                                                          Ty.apply
                                                            (Ty.path "alloc::boxed::Box")
                                                            []
                                                            [
                                                              Ty.dyn
                                                                [
                                                                  ("existential predicate with variables",
                                                                    []);
                                                                  ("existential predicate with variables",
                                                                    [])
                                                                ];
                                                              Ty.path "alloc::alloc::Global"
                                                            ]
                                                        ]
                                                      |),
                                                      [ M.read (| i |) ]
                                                    |)))
                                              ]
                                            |)))
                                        | _ => M.impossible "wrong number of arguments"
                                        end))
                                ]
                              |)
                            ]
                          |)
                        |)))
                  ]
                |)
              |) in
            let~ inspect_log :=
              M.alloc (|
                M.closure
                  (fun γ =>
                    ltac:(M.monadic
                      match γ with
                      | [ α0 ] =>
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| α0 |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let index := M.copy (| γ |) in
                                  M.read (|
                                    M.match_operator (|
                                      M.alloc (| Value.Tuple [] |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path "alloc::boxed::Box")
                                                          []
                                                          [
                                                            Ty.dyn
                                                              [
                                                                ("existential predicate with variables",
                                                                  []);
                                                                ("existential predicate with variables",
                                                                  [])
                                                              ];
                                                            Ty.path "alloc::alloc::Global"
                                                          ]
                                                      ],
                                                    "get_mut",
                                                    [ Ty.path "usize" ]
                                                  |),
                                                  [
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::deref::DerefMut",
                                                        Ty.apply
                                                          (Ty.path "alloc::vec::Vec")
                                                          []
                                                          [
                                                            Ty.apply
                                                              (Ty.path "alloc::boxed::Box")
                                                              []
                                                              [
                                                                Ty.dyn
                                                                  [
                                                                    ("existential predicate with variables",
                                                                      []);
                                                                    ("existential predicate with variables",
                                                                      [])
                                                                  ];
                                                                Ty.path "alloc::alloc::Global"
                                                              ];
                                                            Ty.path "alloc::alloc::Global"
                                                          ],
                                                        [],
                                                        "deref_mut",
                                                        []
                                                      |),
                                                      [ table ]
                                                    |);
                                                    M.rust_cast (M.read (| index |))
                                                  ]
                                                |)
                                              |) in
                                            let γ0_0 :=
                                              M.SubPointer.get_struct_tuple_field (|
                                                γ,
                                                "core::option::Option::Some",
                                                0
                                              |) in
                                            let i := M.copy (| γ0_0 |) in
                                            let~ old :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "core::mem::replace",
                                                    [
                                                      Ty.apply
                                                        (Ty.path "alloc::boxed::Box")
                                                        []
                                                        [
                                                          Ty.dyn
                                                            [
                                                              ("existential predicate with variables",
                                                                []);
                                                              ("existential predicate with variables",
                                                                [])
                                                            ];
                                                          Ty.path "alloc::alloc::Global"
                                                        ]
                                                    ]
                                                  |),
                                                  [
                                                    M.read (| i |);
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.apply
                                                          (Ty.path "alloc::boxed::Box")
                                                          []
                                                          [
                                                            Ty.function
                                                              [
                                                                Ty.tuple
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path "&mut")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "revm_interpreter::interpreter::Interpreter"
                                                                      ];
                                                                    Ty.apply
                                                                      (Ty.path "&mut")
                                                                      []
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path "revm::evm::Evm")
                                                                          []
                                                                          [ EXT; DB ]
                                                                      ]
                                                                  ]
                                                              ]
                                                              (Ty.tuple []);
                                                            Ty.path "alloc::alloc::Global"
                                                          ],
                                                        "new",
                                                        []
                                                      |),
                                                      [
                                                        M.closure
                                                          (fun γ =>
                                                            ltac:(M.monadic
                                                              match γ with
                                                              | [ α0; α1 ] =>
                                                                ltac:(M.monadic
                                                                  (M.match_operator (|
                                                                    M.alloc (| α0 |),
                                                                    [
                                                                      fun γ =>
                                                                        ltac:(M.monadic
                                                                          (M.match_operator (|
                                                                            M.alloc (| α1 |),
                                                                            [
                                                                              fun γ =>
                                                                                ltac:(M.monadic
                                                                                  (Value.Tuple []))
                                                                            ]
                                                                          |)))
                                                                    ]
                                                                  |)))
                                                              | _ =>
                                                                M.impossible
                                                                  "wrong number of arguments"
                                                              end))
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              |) in
                                            M.write (|
                                              M.read (| i |),
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply
                                                    (Ty.path "alloc::boxed::Box")
                                                    []
                                                    [
                                                      Ty.function
                                                        [
                                                          Ty.tuple
                                                            [
                                                              Ty.apply
                                                                (Ty.path "&mut")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "revm_interpreter::interpreter::Interpreter"
                                                                ];
                                                              Ty.apply
                                                                (Ty.path "&mut")
                                                                []
                                                                [
                                                                  Ty.apply
                                                                    (Ty.path "revm::evm::Evm")
                                                                    []
                                                                    [ EXT; DB ]
                                                                ]
                                                            ]
                                                        ]
                                                        (Ty.tuple []);
                                                      Ty.path "alloc::alloc::Global"
                                                    ],
                                                  "new",
                                                  []
                                                |),
                                                [
                                                  M.closure
                                                    (fun γ =>
                                                      ltac:(M.monadic
                                                        match γ with
                                                        | [ α0; α1 ] =>
                                                          ltac:(M.monadic
                                                            (M.match_operator (|
                                                              M.alloc (| α0 |),
                                                              [
                                                                fun γ =>
                                                                  ltac:(M.monadic
                                                                    (let interpreter :=
                                                                      M.copy (| γ |) in
                                                                    M.match_operator (|
                                                                      M.alloc (| α1 |),
                                                                      [
                                                                        fun γ =>
                                                                          ltac:(M.monadic
                                                                            (let host :=
                                                                              M.copy (| γ |) in
                                                                            M.read (|
                                                                              let~ old_log_len :=
                                                                                M.alloc (|
                                                                                  M.call_closure (|
                                                                                    M.get_associated_function (|
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "alloc::vec::Vec")
                                                                                        []
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "alloy_primitives::log::Log")
                                                                                            []
                                                                                            [
                                                                                              Ty.path
                                                                                                "alloy_primitives::log::LogData"
                                                                                            ];
                                                                                          Ty.path
                                                                                            "alloc::alloc::Global"
                                                                                        ],
                                                                                      "len",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.SubPointer.get_struct_record_field (|
                                                                                        M.SubPointer.get_struct_record_field (|
                                                                                          M.call_closure (|
                                                                                            M.get_trait_method (|
                                                                                              "core::ops::deref::Deref",
                                                                                              Ty.apply
                                                                                                (Ty.path
                                                                                                  "revm::context::evm_context::EvmContext")
                                                                                                []
                                                                                                [ DB
                                                                                                ],
                                                                                              [],
                                                                                              "deref",
                                                                                              []
                                                                                            |),
                                                                                            [
                                                                                              M.SubPointer.get_struct_record_field (|
                                                                                                M.SubPointer.get_struct_record_field (|
                                                                                                  M.read (|
                                                                                                    host
                                                                                                  |),
                                                                                                  "revm::evm::Evm",
                                                                                                  "context"
                                                                                                |),
                                                                                                "revm::context::Context",
                                                                                                "evm"
                                                                                              |)
                                                                                            ]
                                                                                          |),
                                                                                          "revm::context::inner_evm_context::InnerEvmContext",
                                                                                          "journaled_state"
                                                                                        |),
                                                                                        "revm::journaled_state::JournaledState",
                                                                                        "logs"
                                                                                      |)
                                                                                    ]
                                                                                  |)
                                                                                |) in
                                                                              let~ _ :=
                                                                                M.alloc (|
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::ops::function::Fn",
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "alloc::boxed::Box")
                                                                                        []
                                                                                        [
                                                                                          Ty.dyn
                                                                                            [
                                                                                              ("existential predicate with variables",
                                                                                                []);
                                                                                              ("existential predicate with variables",
                                                                                                [])
                                                                                            ];
                                                                                          Ty.path
                                                                                            "alloc::alloc::Global"
                                                                                        ],
                                                                                      [
                                                                                        Ty.tuple
                                                                                          [
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "&mut")
                                                                                              []
                                                                                              [
                                                                                                Ty.path
                                                                                                  "revm_interpreter::interpreter::Interpreter"
                                                                                              ];
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "&mut")
                                                                                              []
                                                                                              [
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "revm::evm::Evm")
                                                                                                  []
                                                                                                  [
                                                                                                    EXT;
                                                                                                    DB
                                                                                                  ]
                                                                                              ]
                                                                                          ]
                                                                                      ],
                                                                                      "call",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      old;
                                                                                      Value.Tuple
                                                                                        [
                                                                                          M.read (|
                                                                                            interpreter
                                                                                          |);
                                                                                          M.read (|
                                                                                            host
                                                                                          |)
                                                                                        ]
                                                                                    ]
                                                                                  |)
                                                                                |) in
                                                                              M.match_operator (|
                                                                                M.alloc (|
                                                                                  Value.Tuple []
                                                                                |),
                                                                                [
                                                                                  fun γ =>
                                                                                    ltac:(M.monadic
                                                                                      (let γ :=
                                                                                        M.use
                                                                                          (M.alloc (|
                                                                                            BinOp.eq (|
                                                                                              M.call_closure (|
                                                                                                M.get_associated_function (|
                                                                                                  Ty.apply
                                                                                                    (Ty.path
                                                                                                      "alloc::vec::Vec")
                                                                                                    []
                                                                                                    [
                                                                                                      Ty.apply
                                                                                                        (Ty.path
                                                                                                          "alloy_primitives::log::Log")
                                                                                                        []
                                                                                                        [
                                                                                                          Ty.path
                                                                                                            "alloy_primitives::log::LogData"
                                                                                                        ];
                                                                                                      Ty.path
                                                                                                        "alloc::alloc::Global"
                                                                                                    ],
                                                                                                  "len",
                                                                                                  []
                                                                                                |),
                                                                                                [
                                                                                                  M.SubPointer.get_struct_record_field (|
                                                                                                    M.SubPointer.get_struct_record_field (|
                                                                                                      M.call_closure (|
                                                                                                        M.get_trait_method (|
                                                                                                          "core::ops::deref::Deref",
                                                                                                          Ty.apply
                                                                                                            (Ty.path
                                                                                                              "revm::context::evm_context::EvmContext")
                                                                                                            []
                                                                                                            [
                                                                                                              DB
                                                                                                            ],
                                                                                                          [],
                                                                                                          "deref",
                                                                                                          []
                                                                                                        |),
                                                                                                        [
                                                                                                          M.SubPointer.get_struct_record_field (|
                                                                                                            M.SubPointer.get_struct_record_field (|
                                                                                                              M.read (|
                                                                                                                host
                                                                                                              |),
                                                                                                              "revm::evm::Evm",
                                                                                                              "context"
                                                                                                            |),
                                                                                                            "revm::context::Context",
                                                                                                            "evm"
                                                                                                          |)
                                                                                                        ]
                                                                                                      |),
                                                                                                      "revm::context::inner_evm_context::InnerEvmContext",
                                                                                                      "journaled_state"
                                                                                                    |),
                                                                                                    "revm::journaled_state::JournaledState",
                                                                                                    "logs"
                                                                                                  |)
                                                                                                ]
                                                                                              |),
                                                                                              BinOp.Wrap.add (|
                                                                                                M.read (|
                                                                                                  old_log_len
                                                                                                |),
                                                                                                Value.Integer
                                                                                                  IntegerKind.Usize
                                                                                                  1
                                                                                              |)
                                                                                            |)
                                                                                          |)) in
                                                                                      let _ :=
                                                                                        M.is_constant_or_break_match (|
                                                                                          M.read (|
                                                                                            γ
                                                                                          |),
                                                                                          Value.Bool
                                                                                            true
                                                                                        |) in
                                                                                      let~
                                                                                            last_log :=
                                                                                        M.alloc (|
                                                                                          M.call_closure (|
                                                                                            M.get_trait_method (|
                                                                                              "core::clone::Clone",
                                                                                              Ty.apply
                                                                                                (Ty.path
                                                                                                  "alloy_primitives::log::Log")
                                                                                                []
                                                                                                [
                                                                                                  Ty.path
                                                                                                    "alloy_primitives::log::LogData"
                                                                                                ],
                                                                                              [],
                                                                                              "clone",
                                                                                              []
                                                                                            |),
                                                                                            [
                                                                                              M.call_closure (|
                                                                                                M.get_associated_function (|
                                                                                                  Ty.apply
                                                                                                    (Ty.path
                                                                                                      "core::option::Option")
                                                                                                    []
                                                                                                    [
                                                                                                      Ty.apply
                                                                                                        (Ty.path
                                                                                                          "&")
                                                                                                        []
                                                                                                        [
                                                                                                          Ty.apply
                                                                                                            (Ty.path
                                                                                                              "alloy_primitives::log::Log")
                                                                                                            []
                                                                                                            [
                                                                                                              Ty.path
                                                                                                                "alloy_primitives::log::LogData"
                                                                                                            ]
                                                                                                        ]
                                                                                                    ],
                                                                                                  "unwrap",
                                                                                                  []
                                                                                                |),
                                                                                                [
                                                                                                  M.call_closure (|
                                                                                                    M.get_associated_function (|
                                                                                                      Ty.apply
                                                                                                        (Ty.path
                                                                                                          "slice")
                                                                                                        []
                                                                                                        [
                                                                                                          Ty.apply
                                                                                                            (Ty.path
                                                                                                              "alloy_primitives::log::Log")
                                                                                                            []
                                                                                                            [
                                                                                                              Ty.path
                                                                                                                "alloy_primitives::log::LogData"
                                                                                                            ]
                                                                                                        ],
                                                                                                      "last",
                                                                                                      []
                                                                                                    |),
                                                                                                    [
                                                                                                      M.call_closure (|
                                                                                                        M.get_trait_method (|
                                                                                                          "core::ops::deref::Deref",
                                                                                                          Ty.apply
                                                                                                            (Ty.path
                                                                                                              "alloc::vec::Vec")
                                                                                                            []
                                                                                                            [
                                                                                                              Ty.apply
                                                                                                                (Ty.path
                                                                                                                  "alloy_primitives::log::Log")
                                                                                                                []
                                                                                                                [
                                                                                                                  Ty.path
                                                                                                                    "alloy_primitives::log::LogData"
                                                                                                                ];
                                                                                                              Ty.path
                                                                                                                "alloc::alloc::Global"
                                                                                                            ],
                                                                                                          [],
                                                                                                          "deref",
                                                                                                          []
                                                                                                        |),
                                                                                                        [
                                                                                                          M.SubPointer.get_struct_record_field (|
                                                                                                            M.SubPointer.get_struct_record_field (|
                                                                                                              M.call_closure (|
                                                                                                                M.get_trait_method (|
                                                                                                                  "core::ops::deref::Deref",
                                                                                                                  Ty.apply
                                                                                                                    (Ty.path
                                                                                                                      "revm::context::evm_context::EvmContext")
                                                                                                                    []
                                                                                                                    [
                                                                                                                      DB
                                                                                                                    ],
                                                                                                                  [],
                                                                                                                  "deref",
                                                                                                                  []
                                                                                                                |),
                                                                                                                [
                                                                                                                  M.SubPointer.get_struct_record_field (|
                                                                                                                    M.SubPointer.get_struct_record_field (|
                                                                                                                      M.read (|
                                                                                                                        host
                                                                                                                      |),
                                                                                                                      "revm::evm::Evm",
                                                                                                                      "context"
                                                                                                                    |),
                                                                                                                    "revm::context::Context",
                                                                                                                    "evm"
                                                                                                                  |)
                                                                                                                ]
                                                                                                              |),
                                                                                                              "revm::context::inner_evm_context::InnerEvmContext",
                                                                                                              "journaled_state"
                                                                                                            |),
                                                                                                            "revm::journaled_state::JournaledState",
                                                                                                            "logs"
                                                                                                          |)
                                                                                                        ]
                                                                                                      |)
                                                                                                    ]
                                                                                                  |)
                                                                                                ]
                                                                                              |)
                                                                                            ]
                                                                                          |)
                                                                                        |) in
                                                                                      let~ _ :=
                                                                                        M.alloc (|
                                                                                          M.call_closure (|
                                                                                            M.get_trait_method (|
                                                                                              "revm::inspector::Inspector",
                                                                                              Ty.associated,
                                                                                              [ DB
                                                                                              ],
                                                                                              "log",
                                                                                              []
                                                                                            |),
                                                                                            [
                                                                                              M.call_closure (|
                                                                                                M.get_trait_method (|
                                                                                                  "revm::inspector::handler_register::GetInspector",
                                                                                                  EXT,
                                                                                                  [
                                                                                                    DB
                                                                                                  ],
                                                                                                  "get_inspector",
                                                                                                  []
                                                                                                |),
                                                                                                [
                                                                                                  M.SubPointer.get_struct_record_field (|
                                                                                                    M.SubPointer.get_struct_record_field (|
                                                                                                      M.read (|
                                                                                                        host
                                                                                                      |),
                                                                                                      "revm::evm::Evm",
                                                                                                      "context"
                                                                                                    |),
                                                                                                    "revm::context::Context",
                                                                                                    "external"
                                                                                                  |)
                                                                                                ]
                                                                                              |);
                                                                                              M.SubPointer.get_struct_record_field (|
                                                                                                M.SubPointer.get_struct_record_field (|
                                                                                                  M.read (|
                                                                                                    host
                                                                                                  |),
                                                                                                  "revm::evm::Evm",
                                                                                                  "context"
                                                                                                |),
                                                                                                "revm::context::Context",
                                                                                                "evm"
                                                                                              |);
                                                                                              last_log
                                                                                            ]
                                                                                          |)
                                                                                        |) in
                                                                                      M.alloc (|
                                                                                        Value.Tuple
                                                                                          []
                                                                                      |)));
                                                                                  fun γ =>
                                                                                    ltac:(M.monadic
                                                                                      (M.alloc (|
                                                                                        Value.Tuple
                                                                                          []
                                                                                      |)))
                                                                                ]
                                                                              |)
                                                                            |)))
                                                                      ]
                                                                    |)))
                                                              ]
                                                            |)))
                                                        | _ =>
                                                          M.impossible "wrong number of arguments"
                                                        end))
                                                ]
                                              |)
                                            |)));
                                        fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                      ]
                                    |)
                                  |)))
                            ]
                          |)))
                      | _ => M.impossible "wrong number of arguments"
                      end))
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::function::FnMut",
                    Ty.function [ Ty.tuple [ Ty.path "u8" ] ] (Ty.tuple []),
                    [ Ty.tuple [ Ty.path "u8" ] ],
                    "call_mut",
                    []
                  |),
                  [
                    inspect_log;
                    Value.Tuple
                      [ M.read (| M.get_constant (| "revm_interpreter::opcode::LOG0" |) |) ]
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::function::FnMut",
                    Ty.function [ Ty.tuple [ Ty.path "u8" ] ] (Ty.tuple []),
                    [ Ty.tuple [ Ty.path "u8" ] ],
                    "call_mut",
                    []
                  |),
                  [
                    inspect_log;
                    Value.Tuple
                      [ M.read (| M.get_constant (| "revm_interpreter::opcode::LOG1" |) |) ]
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::function::FnMut",
                    Ty.function [ Ty.tuple [ Ty.path "u8" ] ] (Ty.tuple []),
                    [ Ty.tuple [ Ty.path "u8" ] ],
                    "call_mut",
                    []
                  |),
                  [
                    inspect_log;
                    Value.Tuple
                      [ M.read (| M.get_constant (| "revm_interpreter::opcode::LOG2" |) |) ]
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::function::FnMut",
                    Ty.function [ Ty.tuple [ Ty.path "u8" ] ] (Ty.tuple []),
                    [ Ty.tuple [ Ty.path "u8" ] ],
                    "call_mut",
                    []
                  |),
                  [
                    inspect_log;
                    Value.Tuple
                      [ M.read (| M.get_constant (| "revm_interpreter::opcode::LOG3" |) |) ]
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::function::FnMut",
                    Ty.function [ Ty.tuple [ Ty.path "u8" ] ] (Ty.tuple []),
                    [ Ty.tuple [ Ty.path "u8" ] ],
                    "call_mut",
                    []
                  |),
                  [
                    inspect_log;
                    Value.Tuple
                      [ M.read (| M.get_constant (| "revm_interpreter::opcode::LOG4" |) |) ]
                  ]
                |)
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "slice")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "alloc::boxed::Box")
                                    []
                                    [
                                      Ty.dyn
                                        [
                                          ("existential predicate with variables", []);
                                          ("existential predicate with variables", [])
                                        ];
                                      Ty.path "alloc::alloc::Global"
                                    ]
                                ],
                              "get_mut",
                              [ Ty.path "usize" ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::deref::DerefMut",
                                  Ty.apply
                                    (Ty.path "alloc::vec::Vec")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "alloc::boxed::Box")
                                        []
                                        [
                                          Ty.dyn
                                            [
                                              ("existential predicate with variables", []);
                                              ("existential predicate with variables", [])
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ];
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [],
                                  "deref_mut",
                                  []
                                |),
                                [ table ]
                              |);
                              M.rust_cast
                                (M.read (|
                                  M.get_constant (| "revm_interpreter::opcode::SELFDESTRUCT" |)
                                |))
                            ]
                          |)
                        |) in
                      let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::option::Option::Some",
                          0
                        |) in
                      let i := M.copy (| γ0_0 |) in
                      let~ old :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_function (|
                              "core::mem::replace",
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.dyn
                                      [
                                        ("existential predicate with variables", []);
                                        ("existential predicate with variables", [])
                                      ];
                                    Ty.path "alloc::alloc::Global"
                                  ]
                              ]
                            |),
                            [
                              M.read (| i |);
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "alloc::boxed::Box")
                                    []
                                    [
                                      Ty.function
                                        [
                                          Ty.tuple
                                            [
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [
                                                  Ty.path
                                                    "revm_interpreter::interpreter::Interpreter"
                                                ];
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ]
                                                ]
                                            ]
                                        ]
                                        (Ty.tuple []);
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  "new",
                                  []
                                |),
                                [
                                  M.closure
                                    (fun γ =>
                                      ltac:(M.monadic
                                        match γ with
                                        | [ α0; α1 ] =>
                                          ltac:(M.monadic
                                            (M.match_operator (|
                                              M.alloc (| α0 |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (M.match_operator (|
                                                      M.alloc (| α1 |),
                                                      [ fun γ => ltac:(M.monadic (Value.Tuple [])) ]
                                                    |)))
                                              ]
                                            |)))
                                        | _ => M.impossible "wrong number of arguments"
                                        end))
                                ]
                              |)
                            ]
                          |)
                        |) in
                      M.write (|
                        M.read (| i |),
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::boxed::Box")
                              []
                              [
                                Ty.function
                                  [
                                    Ty.tuple
                                      [
                                        Ty.apply
                                          (Ty.path "&mut")
                                          []
                                          [ Ty.path "revm_interpreter::interpreter::Interpreter" ];
                                        Ty.apply
                                          (Ty.path "&mut")
                                          []
                                          [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ] ]
                                      ]
                                  ]
                                  (Ty.tuple []);
                                Ty.path "alloc::alloc::Global"
                              ],
                            "new",
                            []
                          |),
                          [
                            M.closure
                              (fun γ =>
                                ltac:(M.monadic
                                  match γ with
                                  | [ α0; α1 ] =>
                                    ltac:(M.monadic
                                      (M.match_operator (|
                                        M.alloc (| α0 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let interpreter := M.copy (| γ |) in
                                              M.match_operator (|
                                                M.alloc (| α1 |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let host := M.copy (| γ |) in
                                                      M.read (|
                                                        let~ _ :=
                                                          M.alloc (|
                                                            M.call_closure (|
                                                              M.get_trait_method (|
                                                                "core::ops::function::Fn",
                                                                Ty.apply
                                                                  (Ty.path "alloc::boxed::Box")
                                                                  []
                                                                  [
                                                                    Ty.dyn
                                                                      [
                                                                        ("existential predicate with variables",
                                                                          []);
                                                                        ("existential predicate with variables",
                                                                          [])
                                                                      ];
                                                                    Ty.path "alloc::alloc::Global"
                                                                  ],
                                                                [
                                                                  Ty.tuple
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path "&mut")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "revm_interpreter::interpreter::Interpreter"
                                                                        ];
                                                                      Ty.apply
                                                                        (Ty.path "&mut")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "revm::evm::Evm")
                                                                            []
                                                                            [ EXT; DB ]
                                                                        ]
                                                                    ]
                                                                ],
                                                                "call",
                                                                []
                                                              |),
                                                              [
                                                                old;
                                                                Value.Tuple
                                                                  [
                                                                    M.read (| interpreter |);
                                                                    M.read (| host |)
                                                                  ]
                                                              ]
                                                            |)
                                                          |) in
                                                        M.match_operator (|
                                                          M.alloc (| Value.Tuple [] |),
                                                          [
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let γ :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.apply
                                                                          (Ty.path "slice")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "revm::journaled_state::JournalEntry"
                                                                          ],
                                                                        "last",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "core::ops::deref::Deref",
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::vec::Vec")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "revm::journaled_state::JournalEntry";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ],
                                                                            [],
                                                                            "deref",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_associated_function (|
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "core::option::Option")
                                                                                  []
                                                                                  [
                                                                                    Ty.apply
                                                                                      (Ty.path "&")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "alloc::vec::Vec")
                                                                                          []
                                                                                          [
                                                                                            Ty.path
                                                                                              "revm::journaled_state::JournalEntry";
                                                                                            Ty.path
                                                                                              "alloc::alloc::Global"
                                                                                          ]
                                                                                      ]
                                                                                  ],
                                                                                "unwrap",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.call_closure (|
                                                                                  M.get_associated_function (|
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "slice")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "alloc::vec::Vec")
                                                                                          []
                                                                                          [
                                                                                            Ty.path
                                                                                              "revm::journaled_state::JournalEntry";
                                                                                            Ty.path
                                                                                              "alloc::alloc::Global"
                                                                                          ]
                                                                                      ],
                                                                                    "last",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    M.call_closure (|
                                                                                      M.get_trait_method (|
                                                                                        "core::ops::deref::Deref",
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "alloc::vec::Vec")
                                                                                          []
                                                                                          [
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "alloc::vec::Vec")
                                                                                              []
                                                                                              [
                                                                                                Ty.path
                                                                                                  "revm::journaled_state::JournalEntry";
                                                                                                Ty.path
                                                                                                  "alloc::alloc::Global"
                                                                                              ];
                                                                                            Ty.path
                                                                                              "alloc::alloc::Global"
                                                                                          ],
                                                                                        [],
                                                                                        "deref",
                                                                                        []
                                                                                      |),
                                                                                      [
                                                                                        M.SubPointer.get_struct_record_field (|
                                                                                          M.SubPointer.get_struct_record_field (|
                                                                                            M.call_closure (|
                                                                                              M.get_trait_method (|
                                                                                                "core::ops::deref::Deref",
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "revm::context::evm_context::EvmContext")
                                                                                                  []
                                                                                                  [
                                                                                                    DB
                                                                                                  ],
                                                                                                [],
                                                                                                "deref",
                                                                                                []
                                                                                              |),
                                                                                              [
                                                                                                M.SubPointer.get_struct_record_field (|
                                                                                                  M.SubPointer.get_struct_record_field (|
                                                                                                    M.read (|
                                                                                                      host
                                                                                                    |),
                                                                                                    "revm::evm::Evm",
                                                                                                    "context"
                                                                                                  |),
                                                                                                  "revm::context::Context",
                                                                                                  "evm"
                                                                                                |)
                                                                                              ]
                                                                                            |),
                                                                                            "revm::context::inner_evm_context::InnerEvmContext",
                                                                                            "journaled_state"
                                                                                          |),
                                                                                          "revm::journaled_state::JournaledState",
                                                                                          "journal"
                                                                                        |)
                                                                                      ]
                                                                                    |)
                                                                                  ]
                                                                                |)
                                                                              ]
                                                                            |)
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                let γ0_0 :=
                                                                  M.SubPointer.get_struct_tuple_field (|
                                                                    γ,
                                                                    "core::option::Option::Some",
                                                                    0
                                                                  |) in
                                                                let γ0_0 := M.read (| γ0_0 |) in
                                                                let γ2_0 :=
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    γ0_0,
                                                                    "revm::journaled_state::JournalEntry::AccountDestroyed",
                                                                    "address"
                                                                  |) in
                                                                let γ2_1 :=
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    γ0_0,
                                                                    "revm::journaled_state::JournalEntry::AccountDestroyed",
                                                                    "target"
                                                                  |) in
                                                                let γ2_2 :=
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    γ0_0,
                                                                    "revm::journaled_state::JournalEntry::AccountDestroyed",
                                                                    "had_balance"
                                                                  |) in
                                                                let address := M.alloc (| γ2_0 |) in
                                                                let target := M.alloc (| γ2_1 |) in
                                                                let had_balance :=
                                                                  M.alloc (| γ2_2 |) in
                                                                let~ _ :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "revm::inspector::Inspector",
                                                                        Ty.associated,
                                                                        [ DB ],
                                                                        "selfdestruct",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "revm::inspector::handler_register::GetInspector",
                                                                            EXT,
                                                                            [ DB ],
                                                                            "get_inspector",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.SubPointer.get_struct_record_field (|
                                                                              M.SubPointer.get_struct_record_field (|
                                                                                M.read (| host |),
                                                                                "revm::evm::Evm",
                                                                                "context"
                                                                              |),
                                                                              "revm::context::Context",
                                                                              "external"
                                                                            |)
                                                                          ]
                                                                        |);
                                                                        M.read (|
                                                                          M.read (| address |)
                                                                        |);
                                                                        M.read (|
                                                                          M.read (| target |)
                                                                        |);
                                                                        M.read (|
                                                                          M.read (| had_balance |)
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                M.alloc (| Value.Tuple [] |)));
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (M.alloc (| Value.Tuple [] |)))
                                                          ]
                                                        |)
                                                      |)))
                                                ]
                                              |)))
                                        ]
                                      |)))
                                  | _ => M.impossible "wrong number of arguments"
                                  end))
                          ]
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "revm::handler::Handler")
                      []
                      [ Ty.apply (Ty.path "revm::evm::Evm") [] [ EXT; DB ]; EXT; DB ],
                    "set_instruction_table",
                    []
                  |),
                  [
                    M.read (| handler |);
                    Value.StructTuple
                      "revm_interpreter::opcode::InstructionTables::Boxed"
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "core::result::Result")
                              []
                              [
                                Ty.apply
                                  (Ty.path "array")
                                  [ Value.Integer IntegerKind.Usize 256 ]
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ]
                                  ];
                                Ty.apply
                                  (Ty.path "alloc::vec::Vec")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ];
                                    Ty.path "alloc::alloc::Global"
                                  ]
                              ],
                            "unwrap_or_else",
                            [
                              Ty.function
                                [
                                  Ty.tuple
                                    [
                                      Ty.apply
                                        (Ty.path "alloc::vec::Vec")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "alloc::boxed::Box")
                                            []
                                            [
                                              Ty.dyn
                                                [
                                                  ("existential predicate with variables", []);
                                                  ("existential predicate with variables", [])
                                                ];
                                              Ty.path "alloc::alloc::Global"
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ]
                                    ]
                                ]
                                (Ty.apply
                                  (Ty.path "array")
                                  [ Value.Integer IntegerKind.Usize 256 ]
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ]
                                  ])
                            ]
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::convert::TryInto",
                                Ty.apply
                                  (Ty.path "alloc::vec::Vec")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "alloc::boxed::Box")
                                      []
                                      [
                                        Ty.dyn
                                          [
                                            ("existential predicate with variables", []);
                                            ("existential predicate with variables", [])
                                          ];
                                        Ty.path "alloc::alloc::Global"
                                      ];
                                    Ty.path "alloc::alloc::Global"
                                  ],
                                [
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 256 ]
                                    [
                                      Ty.apply
                                        (Ty.path "alloc::boxed::Box")
                                        []
                                        [
                                          Ty.dyn
                                            [
                                              ("existential predicate with variables", []);
                                              ("existential predicate with variables", [])
                                            ];
                                          Ty.path "alloc::alloc::Global"
                                        ]
                                    ]
                                ],
                                "try_into",
                                []
                              |),
                              [ M.read (| table |) ]
                            |);
                            M.closure
                              (fun γ =>
                                ltac:(M.monadic
                                  match γ with
                                  | [ α0 ] =>
                                    ltac:(M.monadic
                                      (M.match_operator (|
                                        M.alloc (| α0 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (M.never_to_any (|
                                                M.call_closure (|
                                                  M.get_function (| "core::panicking::panic", [] |),
                                                  [
                                                    M.read (|
                                                      Value.String
                                                        "internal error: entered unreachable code"
                                                    |)
                                                  ]
                                                |)
                                              |)))
                                        ]
                                      |)))
                                  | _ => M.impossible "wrong number of arguments"
                                  end))
                          ]
                        |)
                      ]
                  ]
                |)
              |) in
            let~ call_input_stack :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ],
                        "new",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ],
                            "new",
                            []
                          |),
                          []
                        |)
                      ]
                    |)
                  ]
                |)
              |) in
            let~ create_input_stack :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ],
                        "new",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ],
                            "new",
                            []
                          |),
                          []
                        |)
                      ]
                    |)
                  ]
                |)
              |) in
            let~ eofcreate_input_stack :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.path
                                  "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.path
                                  "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                Ty.path "alloc::alloc::Global"
                              ]
                          ],
                        "new",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.path
                                  "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                Ty.path "alloc::alloc::Global"
                              ],
                            "new",
                            []
                          |),
                          []
                        |)
                      ]
                    |)
                  ]
                |)
              |) in
            let~ create_input_stack_inner :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [ create_input_stack ]
                |)
              |) in
            let~ old_handle :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.dyn
                          [
                            ("existential predicate with variables", []);
                            ("existential predicate with variables", [])
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| handler |),
                        "revm::handler::Handler",
                        "execution"
                      |),
                      "revm::handler::handle_types::execution::ExecutionHandler",
                      "create"
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.write (|
                M.SubPointer.get_struct_record_field (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| handler |),
                    "revm::handler::Handler",
                    "execution"
                  |),
                  "revm::handler::handle_types::execution::ExecutionHandler",
                  "create"
                |),
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.function
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "revm::context::Context") [] [ EXT; DB ] ];
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ]
                              ]
                          ]
                          (Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [
                              Ty.path "revm::frame::FrameOrResult";
                              Ty.apply
                                (Ty.path "revm_primitives::result::EVMError")
                                []
                                [ Ty.associated ]
                            ]);
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0; α1 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let ctx := M.copy (| γ |) in
                                      M.match_operator (|
                                        M.alloc (| α1 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let inputs := M.copy (| γ |) in
                                              M.read (|
                                                let~ inspector :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "revm::inspector::handler_register::GetInspector",
                                                        EXT,
                                                        [ DB ],
                                                        "get_inspector",
                                                        []
                                                      |),
                                                      [
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| ctx |),
                                                          "revm::context::Context",
                                                          "external"
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ :=
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "revm::inspector::Inspector",
                                                                  Ty.associated,
                                                                  [ DB ],
                                                                  "create",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| inspector |);
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    M.read (| ctx |),
                                                                    "revm::context::Context",
                                                                    "evm"
                                                                  |);
                                                                  M.read (| inputs |)
                                                                ]
                                                              |)
                                                            |) in
                                                          let γ0_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "core::option::Option::Some",
                                                              0
                                                            |) in
                                                          let outcome := M.copy (| γ0_0 |) in
                                                          M.alloc (|
                                                            M.never_to_any (|
                                                              M.read (|
                                                                let~ _ :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "alloc::vec::Vec")
                                                                          []
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::boxed::Box")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ];
                                                                            Ty.path
                                                                              "alloc::alloc::Global"
                                                                          ],
                                                                        "push",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "core::ops::deref::DerefMut",
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "core::cell::RefMut")
                                                                              []
                                                                              [
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "alloc::vec::Vec")
                                                                                  []
                                                                                  [
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::boxed::Box")
                                                                                      []
                                                                                      [
                                                                                        Ty.path
                                                                                          "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ];
                                                                                    Ty.path
                                                                                      "alloc::alloc::Global"
                                                                                  ]
                                                                              ],
                                                                            [],
                                                                            "deref_mut",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.alloc (|
                                                                              M.call_closure (|
                                                                                M.get_associated_function (|
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "core::cell::RefCell")
                                                                                    []
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "alloc::vec::Vec")
                                                                                        []
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "alloc::boxed::Box")
                                                                                            []
                                                                                            [
                                                                                              Ty.path
                                                                                                "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                              Ty.path
                                                                                                "alloc::alloc::Global"
                                                                                            ];
                                                                                          Ty.path
                                                                                            "alloc::alloc::Global"
                                                                                        ]
                                                                                    ],
                                                                                  "borrow_mut",
                                                                                  []
                                                                                |),
                                                                                [
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::ops::deref::Deref",
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "alloc::rc::Rc")
                                                                                        []
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "core::cell::RefCell")
                                                                                            []
                                                                                            [
                                                                                              Ty.apply
                                                                                                (Ty.path
                                                                                                  "alloc::vec::Vec")
                                                                                                []
                                                                                                [
                                                                                                  Ty.apply
                                                                                                    (Ty.path
                                                                                                      "alloc::boxed::Box")
                                                                                                    []
                                                                                                    [
                                                                                                      Ty.path
                                                                                                        "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                                      Ty.path
                                                                                                        "alloc::alloc::Global"
                                                                                                    ];
                                                                                                  Ty.path
                                                                                                    "alloc::alloc::Global"
                                                                                                ]
                                                                                            ];
                                                                                          Ty.path
                                                                                            "alloc::alloc::Global"
                                                                                        ],
                                                                                      [],
                                                                                      "deref",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      create_input_stack_inner
                                                                                    ]
                                                                                  |)
                                                                                ]
                                                                              |)
                                                                            |)
                                                                          ]
                                                                        |);
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "core::clone::Clone",
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::boxed::Box")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ],
                                                                            [],
                                                                            "clone",
                                                                            []
                                                                          |),
                                                                          [ inputs ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                M.return_ (|
                                                                  Value.StructTuple
                                                                    "core::result::Result::Ok"
                                                                    [
                                                                      Value.StructTuple
                                                                        "revm::frame::FrameOrResult::Result"
                                                                        [
                                                                          Value.StructTuple
                                                                            "revm::frame::FrameResult::Create"
                                                                            [ M.read (| outcome |) ]
                                                                        ]
                                                                    ]
                                                                |)
                                                              |)
                                                            |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                let~ _ :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.apply
                                                          (Ty.path "alloc::vec::Vec")
                                                          []
                                                          [
                                                            Ty.apply
                                                              (Ty.path "alloc::boxed::Box")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                Ty.path "alloc::alloc::Global"
                                                              ];
                                                            Ty.path "alloc::alloc::Global"
                                                          ],
                                                        "push",
                                                        []
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::deref::DerefMut",
                                                            Ty.apply
                                                              (Ty.path "core::cell::RefMut")
                                                              []
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "alloc::vec::Vec")
                                                                  []
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path "alloc::boxed::Box")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                        Ty.path
                                                                          "alloc::alloc::Global"
                                                                      ];
                                                                    Ty.path "alloc::alloc::Global"
                                                                  ]
                                                              ],
                                                            [],
                                                            "deref_mut",
                                                            []
                                                          |),
                                                          [
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.apply
                                                                    (Ty.path "core::cell::RefCell")
                                                                    []
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::boxed::Box")
                                                                            []
                                                                            [
                                                                              Ty.path
                                                                                "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ]
                                                                    ],
                                                                  "borrow_mut",
                                                                  []
                                                                |),
                                                                [
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::deref::Deref",
                                                                      Ty.apply
                                                                        (Ty.path "alloc::rc::Rc")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::cell::RefCell")
                                                                            []
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "alloc::vec::Vec")
                                                                                []
                                                                                [
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "alloc::boxed::Box")
                                                                                    []
                                                                                    [
                                                                                      Ty.path
                                                                                        "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                      Ty.path
                                                                                        "alloc::alloc::Global"
                                                                                    ];
                                                                                  Ty.path
                                                                                    "alloc::alloc::Global"
                                                                                ]
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      [],
                                                                      "deref",
                                                                      []
                                                                    |),
                                                                    [ create_input_stack_inner ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |)
                                                          ]
                                                        |);
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::clone::Clone",
                                                            Ty.apply
                                                              (Ty.path "alloc::boxed::Box")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                Ty.path "alloc::alloc::Global"
                                                              ],
                                                            [],
                                                            "clone",
                                                            []
                                                          |),
                                                          [ inputs ]
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ frame_or_result :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::function::Fn",
                                                        Ty.dyn
                                                          [
                                                            ("existential predicate with variables",
                                                              []);
                                                            ("existential predicate with variables",
                                                              [])
                                                          ],
                                                        [
                                                          Ty.tuple
                                                            [
                                                              Ty.apply
                                                                (Ty.path "&mut")
                                                                []
                                                                [
                                                                  Ty.apply
                                                                    (Ty.path
                                                                      "revm::context::Context")
                                                                    []
                                                                    [ EXT; DB ]
                                                                ];
                                                              Ty.apply
                                                                (Ty.path "alloc::boxed::Box")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                  Ty.path "alloc::alloc::Global"
                                                                ]
                                                            ]
                                                        ],
                                                        "call",
                                                        []
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::deref::Deref",
                                                            Ty.apply
                                                              (Ty.path "alloc::sync::Arc")
                                                              []
                                                              [
                                                                Ty.dyn
                                                                  [
                                                                    ("existential predicate with variables",
                                                                      []);
                                                                    ("existential predicate with variables",
                                                                      [])
                                                                  ];
                                                                Ty.path "alloc::alloc::Global"
                                                              ],
                                                            [],
                                                            "deref",
                                                            []
                                                          |),
                                                          [ old_handle ]
                                                        |);
                                                        Value.Tuple
                                                          [ M.read (| ctx |); M.read (| inputs |) ]
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.alloc (| frame_or_result |) in
                                                          let γ := M.read (| γ |) in
                                                          let γ1_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "core::result::Result::Ok",
                                                              0
                                                            |) in
                                                          let γ2_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ1_0,
                                                              "revm::frame::FrameOrResult::Frame",
                                                              0
                                                            |) in
                                                          let frame := M.alloc (| γ2_0 |) in
                                                          M.alloc (|
                                                            M.call_closure (|
                                                              M.get_trait_method (|
                                                                "revm::inspector::Inspector",
                                                                Ty.associated,
                                                                [ DB ],
                                                                "initialize_interp",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "revm::inspector::handler_register::GetInspector",
                                                                    EXT,
                                                                    [ DB ],
                                                                    "get_inspector",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (| ctx |),
                                                                      "revm::context::Context",
                                                                      "external"
                                                                    |)
                                                                  ]
                                                                |);
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path "revm::frame::Frame",
                                                                    "interpreter_mut",
                                                                    []
                                                                  |),
                                                                  [ M.read (| frame |) ]
                                                                |);
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| ctx |),
                                                                  "revm::context::Context",
                                                                  "evm"
                                                                |)
                                                              ]
                                                            |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                frame_or_result
                                              |)))
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            let~ call_input_stack_inner :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [ call_input_stack ]
                |)
              |) in
            let~ old_handle :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.dyn
                          [
                            ("existential predicate with variables", []);
                            ("existential predicate with variables", [])
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| handler |),
                        "revm::handler::Handler",
                        "execution"
                      |),
                      "revm::handler::handle_types::execution::ExecutionHandler",
                      "call"
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.write (|
                M.SubPointer.get_struct_record_field (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| handler |),
                    "revm::handler::Handler",
                    "execution"
                  |),
                  "revm::handler::handle_types::execution::ExecutionHandler",
                  "call"
                |),
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.function
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "revm::context::Context") [] [ EXT; DB ] ];
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ]
                              ]
                          ]
                          (Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [
                              Ty.path "revm::frame::FrameOrResult";
                              Ty.apply
                                (Ty.path "revm_primitives::result::EVMError")
                                []
                                [ Ty.associated ]
                            ]);
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0; α1 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let ctx := M.copy (| γ |) in
                                      M.match_operator (|
                                        M.alloc (| α1 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let inputs := M.copy (| γ |) in
                                              M.read (|
                                                let~ outcome :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "revm::inspector::Inspector",
                                                        Ty.associated,
                                                        [ DB ],
                                                        "call",
                                                        []
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "revm::inspector::handler_register::GetInspector",
                                                            EXT,
                                                            [ DB ],
                                                            "get_inspector",
                                                            []
                                                          |),
                                                          [
                                                            M.SubPointer.get_struct_record_field (|
                                                              M.read (| ctx |),
                                                              "revm::context::Context",
                                                              "external"
                                                            |)
                                                          ]
                                                        |);
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| ctx |),
                                                          "revm::context::Context",
                                                          "evm"
                                                        |);
                                                        M.read (| inputs |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.apply
                                                          (Ty.path "alloc::vec::Vec")
                                                          []
                                                          [
                                                            Ty.apply
                                                              (Ty.path "alloc::boxed::Box")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                Ty.path "alloc::alloc::Global"
                                                              ];
                                                            Ty.path "alloc::alloc::Global"
                                                          ],
                                                        "push",
                                                        []
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::deref::DerefMut",
                                                            Ty.apply
                                                              (Ty.path "core::cell::RefMut")
                                                              []
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "alloc::vec::Vec")
                                                                  []
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path "alloc::boxed::Box")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                        Ty.path
                                                                          "alloc::alloc::Global"
                                                                      ];
                                                                    Ty.path "alloc::alloc::Global"
                                                                  ]
                                                              ],
                                                            [],
                                                            "deref_mut",
                                                            []
                                                          |),
                                                          [
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.apply
                                                                    (Ty.path "core::cell::RefCell")
                                                                    []
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::boxed::Box")
                                                                            []
                                                                            [
                                                                              Ty.path
                                                                                "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ]
                                                                    ],
                                                                  "borrow_mut",
                                                                  []
                                                                |),
                                                                [
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::deref::Deref",
                                                                      Ty.apply
                                                                        (Ty.path "alloc::rc::Rc")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::cell::RefCell")
                                                                            []
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "alloc::vec::Vec")
                                                                                []
                                                                                [
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "alloc::boxed::Box")
                                                                                    []
                                                                                    [
                                                                                      Ty.path
                                                                                        "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                      Ty.path
                                                                                        "alloc::alloc::Global"
                                                                                    ];
                                                                                  Ty.path
                                                                                    "alloc::alloc::Global"
                                                                                ]
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      [],
                                                                      "deref",
                                                                      []
                                                                    |),
                                                                    [ call_input_stack_inner ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |)
                                                          ]
                                                        |);
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::clone::Clone",
                                                            Ty.apply
                                                              (Ty.path "alloc::boxed::Box")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                Ty.path "alloc::alloc::Global"
                                                              ],
                                                            [],
                                                            "clone",
                                                            []
                                                          |),
                                                          [ inputs ]
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := outcome in
                                                          let γ0_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "core::option::Option::Some",
                                                              0
                                                            |) in
                                                          let outcome := M.copy (| γ0_0 |) in
                                                          M.alloc (|
                                                            M.never_to_any (|
                                                              M.read (|
                                                                M.return_ (|
                                                                  Value.StructTuple
                                                                    "core::result::Result::Ok"
                                                                    [
                                                                      Value.StructTuple
                                                                        "revm::frame::FrameOrResult::Result"
                                                                        [
                                                                          Value.StructTuple
                                                                            "revm::frame::FrameResult::Call"
                                                                            [ M.read (| outcome |) ]
                                                                        ]
                                                                    ]
                                                                |)
                                                              |)
                                                            |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                let~ frame_or_result :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::function::Fn",
                                                        Ty.dyn
                                                          [
                                                            ("existential predicate with variables",
                                                              []);
                                                            ("existential predicate with variables",
                                                              [])
                                                          ],
                                                        [
                                                          Ty.tuple
                                                            [
                                                              Ty.apply
                                                                (Ty.path "&mut")
                                                                []
                                                                [
                                                                  Ty.apply
                                                                    (Ty.path
                                                                      "revm::context::Context")
                                                                    []
                                                                    [ EXT; DB ]
                                                                ];
                                                              Ty.apply
                                                                (Ty.path "alloc::boxed::Box")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                  Ty.path "alloc::alloc::Global"
                                                                ]
                                                            ]
                                                        ],
                                                        "call",
                                                        []
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::deref::Deref",
                                                            Ty.apply
                                                              (Ty.path "alloc::sync::Arc")
                                                              []
                                                              [
                                                                Ty.dyn
                                                                  [
                                                                    ("existential predicate with variables",
                                                                      []);
                                                                    ("existential predicate with variables",
                                                                      [])
                                                                  ];
                                                                Ty.path "alloc::alloc::Global"
                                                              ],
                                                            [],
                                                            "deref",
                                                            []
                                                          |),
                                                          [ old_handle ]
                                                        |);
                                                        Value.Tuple
                                                          [ M.read (| ctx |); M.read (| inputs |) ]
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.alloc (| frame_or_result |) in
                                                          let γ := M.read (| γ |) in
                                                          let γ1_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "core::result::Result::Ok",
                                                              0
                                                            |) in
                                                          let γ2_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ1_0,
                                                              "revm::frame::FrameOrResult::Frame",
                                                              0
                                                            |) in
                                                          let frame := M.alloc (| γ2_0 |) in
                                                          M.alloc (|
                                                            M.call_closure (|
                                                              M.get_trait_method (|
                                                                "revm::inspector::Inspector",
                                                                Ty.associated,
                                                                [ DB ],
                                                                "initialize_interp",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "revm::inspector::handler_register::GetInspector",
                                                                    EXT,
                                                                    [ DB ],
                                                                    "get_inspector",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (| ctx |),
                                                                      "revm::context::Context",
                                                                      "external"
                                                                    |)
                                                                  ]
                                                                |);
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path "revm::frame::Frame",
                                                                    "interpreter_mut",
                                                                    []
                                                                  |),
                                                                  [ M.read (| frame |) ]
                                                                |);
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| ctx |),
                                                                  "revm::context::Context",
                                                                  "evm"
                                                                |)
                                                              ]
                                                            |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                frame_or_result
                                              |)))
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            let~ call_input_stack_inner :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [ call_input_stack ]
                |)
              |) in
            let~ old_handle :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.dyn
                          [
                            ("existential predicate with variables", []);
                            ("existential predicate with variables", [])
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| handler |),
                        "revm::handler::Handler",
                        "execution"
                      |),
                      "revm::handler::handle_types::execution::ExecutionHandler",
                      "insert_call_outcome"
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.write (|
                M.SubPointer.get_struct_record_field (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| handler |),
                    "revm::handler::Handler",
                    "execution"
                  |),
                  "revm::handler::handle_types::execution::ExecutionHandler",
                  "insert_call_outcome"
                |),
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.function
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "revm::context::Context") [] [ EXT; DB ] ];
                                Ty.apply (Ty.path "&mut") [] [ Ty.path "revm::frame::Frame" ];
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter::shared_memory::SharedMemory"
                                  ];
                                Ty.path
                                  "revm_interpreter::interpreter_action::call_outcome::CallOutcome"
                              ]
                          ]
                          (Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [
                              Ty.tuple [];
                              Ty.apply
                                (Ty.path "revm_primitives::result::EVMError")
                                []
                                [ Ty.associated ]
                            ]);
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0; α1; α2; α3 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let ctx := M.copy (| γ |) in
                                      M.match_operator (|
                                        M.alloc (| α1 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let frame := M.copy (| γ |) in
                                              M.match_operator (|
                                                M.alloc (| α2 |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let shared_memory := M.copy (| γ |) in
                                                      M.match_operator (|
                                                        M.alloc (| α3 |),
                                                        [
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let outcome := M.copy (| γ |) in
                                                              M.read (|
                                                                let~ call_inputs :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::option::Option")
                                                                          []
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::boxed::Box")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ]
                                                                          ],
                                                                        "unwrap",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::vec::Vec")
                                                                              []
                                                                              [
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "alloc::boxed::Box")
                                                                                  []
                                                                                  [
                                                                                    Ty.path
                                                                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                    Ty.path
                                                                                      "alloc::alloc::Global"
                                                                                  ];
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ],
                                                                            "pop",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_trait_method (|
                                                                                "core::ops::deref::DerefMut",
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "core::cell::RefMut")
                                                                                  []
                                                                                  [
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::vec::Vec")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "alloc::boxed::Box")
                                                                                          []
                                                                                          [
                                                                                            Ty.path
                                                                                              "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                            Ty.path
                                                                                              "alloc::alloc::Global"
                                                                                          ];
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ]
                                                                                  ],
                                                                                [],
                                                                                "deref_mut",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.alloc (|
                                                                                  M.call_closure (|
                                                                                    M.get_associated_function (|
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::cell::RefCell")
                                                                                        []
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "alloc::vec::Vec")
                                                                                            []
                                                                                            [
                                                                                              Ty.apply
                                                                                                (Ty.path
                                                                                                  "alloc::boxed::Box")
                                                                                                []
                                                                                                [
                                                                                                  Ty.path
                                                                                                    "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                                  Ty.path
                                                                                                    "alloc::alloc::Global"
                                                                                                ];
                                                                                              Ty.path
                                                                                                "alloc::alloc::Global"
                                                                                            ]
                                                                                        ],
                                                                                      "borrow_mut",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.call_closure (|
                                                                                        M.get_trait_method (|
                                                                                          "core::ops::deref::Deref",
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "alloc::rc::Rc")
                                                                                            []
                                                                                            [
                                                                                              Ty.apply
                                                                                                (Ty.path
                                                                                                  "core::cell::RefCell")
                                                                                                []
                                                                                                [
                                                                                                  Ty.apply
                                                                                                    (Ty.path
                                                                                                      "alloc::vec::Vec")
                                                                                                    []
                                                                                                    [
                                                                                                      Ty.apply
                                                                                                        (Ty.path
                                                                                                          "alloc::boxed::Box")
                                                                                                        []
                                                                                                        [
                                                                                                          Ty.path
                                                                                                            "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                                          Ty.path
                                                                                                            "alloc::alloc::Global"
                                                                                                        ];
                                                                                                      Ty.path
                                                                                                        "alloc::alloc::Global"
                                                                                                    ]
                                                                                                ];
                                                                                              Ty.path
                                                                                                "alloc::alloc::Global"
                                                                                            ],
                                                                                          [],
                                                                                          "deref",
                                                                                          []
                                                                                        |),
                                                                                        [
                                                                                          call_input_stack_inner
                                                                                        ]
                                                                                      |)
                                                                                    ]
                                                                                  |)
                                                                                |)
                                                                              ]
                                                                            |)
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                let~ _ :=
                                                                  M.write (|
                                                                    outcome,
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "revm::inspector::Inspector",
                                                                        Ty.associated,
                                                                        [ DB ],
                                                                        "call_end",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "revm::inspector::handler_register::GetInspector",
                                                                            EXT,
                                                                            [ DB ],
                                                                            "get_inspector",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.SubPointer.get_struct_record_field (|
                                                                              M.read (| ctx |),
                                                                              "revm::context::Context",
                                                                              "external"
                                                                            |)
                                                                          ]
                                                                        |);
                                                                        M.SubPointer.get_struct_record_field (|
                                                                          M.read (| ctx |),
                                                                          "revm::context::Context",
                                                                          "evm"
                                                                        |);
                                                                        M.read (| call_inputs |);
                                                                        M.read (| outcome |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::function::Fn",
                                                                      Ty.dyn
                                                                        [
                                                                          ("existential predicate with variables",
                                                                            []);
                                                                          ("existential predicate with variables",
                                                                            [])
                                                                        ],
                                                                      [
                                                                        Ty.tuple
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path "&mut")
                                                                              []
                                                                              [
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "revm::context::Context")
                                                                                  []
                                                                                  [ EXT; DB ]
                                                                              ];
                                                                            Ty.apply
                                                                              (Ty.path "&mut")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "revm::frame::Frame"
                                                                              ];
                                                                            Ty.apply
                                                                              (Ty.path "&mut")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "revm_interpreter::interpreter::shared_memory::SharedMemory"
                                                                              ];
                                                                            Ty.path
                                                                              "revm_interpreter::interpreter_action::call_outcome::CallOutcome"
                                                                          ]
                                                                      ],
                                                                      "call",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::Deref",
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::sync::Arc")
                                                                            []
                                                                            [
                                                                              Ty.dyn
                                                                                [
                                                                                  ("existential predicate with variables",
                                                                                    []);
                                                                                  ("existential predicate with variables",
                                                                                    [])
                                                                                ];
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ],
                                                                          [],
                                                                          "deref",
                                                                          []
                                                                        |),
                                                                        [ old_handle ]
                                                                      |);
                                                                      Value.Tuple
                                                                        [
                                                                          M.read (| ctx |);
                                                                          M.read (| frame |);
                                                                          M.read (|
                                                                            shared_memory
                                                                          |);
                                                                          M.read (| outcome |)
                                                                        ]
                                                                    ]
                                                                  |)
                                                                |)
                                                              |)))
                                                        ]
                                                      |)))
                                                ]
                                              |)))
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            let~ create_input_stack_inner :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::rc::Rc")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::cell::RefCell")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [
                                Ty.apply
                                  (Ty.path "alloc::boxed::Box")
                                  []
                                  [
                                    Ty.path
                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                    Ty.path "alloc::alloc::Global"
                                  ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [ create_input_stack ]
                |)
              |) in
            let~ old_handle :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.dyn
                          [
                            ("existential predicate with variables", []);
                            ("existential predicate with variables", [])
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| handler |),
                        "revm::handler::Handler",
                        "execution"
                      |),
                      "revm::handler::handle_types::execution::ExecutionHandler",
                      "insert_create_outcome"
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.write (|
                M.SubPointer.get_struct_record_field (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| handler |),
                    "revm::handler::Handler",
                    "execution"
                  |),
                  "revm::handler::handle_types::execution::ExecutionHandler",
                  "insert_create_outcome"
                |),
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.function
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "revm::context::Context") [] [ EXT; DB ] ];
                                Ty.apply (Ty.path "&mut") [] [ Ty.path "revm::frame::Frame" ];
                                Ty.path
                                  "revm_interpreter::interpreter_action::create_outcome::CreateOutcome"
                              ]
                          ]
                          (Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [
                              Ty.tuple [];
                              Ty.apply
                                (Ty.path "revm_primitives::result::EVMError")
                                []
                                [ Ty.associated ]
                            ]);
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0; α1; α2 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let ctx := M.copy (| γ |) in
                                      M.match_operator (|
                                        M.alloc (| α1 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let frame := M.copy (| γ |) in
                                              M.match_operator (|
                                                M.alloc (| α2 |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let outcome := M.copy (| γ |) in
                                                      M.read (|
                                                        let~ create_inputs :=
                                                          M.alloc (|
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.apply
                                                                  (Ty.path "core::option::Option")
                                                                  []
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path "alloc::boxed::Box")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                        Ty.path
                                                                          "alloc::alloc::Global"
                                                                      ]
                                                                  ],
                                                                "unwrap",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.apply
                                                                      (Ty.path "alloc::vec::Vec")
                                                                      []
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "alloc::boxed::Box")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                            Ty.path
                                                                              "alloc::alloc::Global"
                                                                          ];
                                                                        Ty.path
                                                                          "alloc::alloc::Global"
                                                                      ],
                                                                    "pop",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_trait_method (|
                                                                        "core::ops::deref::DerefMut",
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::cell::RefMut")
                                                                          []
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::vec::Vec")
                                                                              []
                                                                              [
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "alloc::boxed::Box")
                                                                                  []
                                                                                  [
                                                                                    Ty.path
                                                                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                    Ty.path
                                                                                      "alloc::alloc::Global"
                                                                                  ];
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ]
                                                                          ],
                                                                        [],
                                                                        "deref_mut",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.alloc (|
                                                                          M.call_closure (|
                                                                            M.get_associated_function (|
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "core::cell::RefCell")
                                                                                []
                                                                                [
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "alloc::vec::Vec")
                                                                                    []
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "alloc::boxed::Box")
                                                                                        []
                                                                                        [
                                                                                          Ty.path
                                                                                            "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                          Ty.path
                                                                                            "alloc::alloc::Global"
                                                                                        ];
                                                                                      Ty.path
                                                                                        "alloc::alloc::Global"
                                                                                    ]
                                                                                ],
                                                                              "borrow_mut",
                                                                              []
                                                                            |),
                                                                            [
                                                                              M.call_closure (|
                                                                                M.get_trait_method (|
                                                                                  "core::ops::deref::Deref",
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "alloc::rc::Rc")
                                                                                    []
                                                                                    [
                                                                                      Ty.apply
                                                                                        (Ty.path
                                                                                          "core::cell::RefCell")
                                                                                        []
                                                                                        [
                                                                                          Ty.apply
                                                                                            (Ty.path
                                                                                              "alloc::vec::Vec")
                                                                                            []
                                                                                            [
                                                                                              Ty.apply
                                                                                                (Ty.path
                                                                                                  "alloc::boxed::Box")
                                                                                                []
                                                                                                [
                                                                                                  Ty.path
                                                                                                    "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                                  Ty.path
                                                                                                    "alloc::alloc::Global"
                                                                                                ];
                                                                                              Ty.path
                                                                                                "alloc::alloc::Global"
                                                                                            ]
                                                                                        ];
                                                                                      Ty.path
                                                                                        "alloc::alloc::Global"
                                                                                    ],
                                                                                  [],
                                                                                  "deref",
                                                                                  []
                                                                                |),
                                                                                [
                                                                                  create_input_stack_inner
                                                                                ]
                                                                              |)
                                                                            ]
                                                                          |)
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  ]
                                                                |)
                                                              ]
                                                            |)
                                                          |) in
                                                        let~ _ :=
                                                          M.write (|
                                                            outcome,
                                                            M.call_closure (|
                                                              M.get_trait_method (|
                                                                "revm::inspector::Inspector",
                                                                Ty.associated,
                                                                [ DB ],
                                                                "create_end",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "revm::inspector::handler_register::GetInspector",
                                                                    EXT,
                                                                    [ DB ],
                                                                    "get_inspector",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (| ctx |),
                                                                      "revm::context::Context",
                                                                      "external"
                                                                    |)
                                                                  ]
                                                                |);
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| ctx |),
                                                                  "revm::context::Context",
                                                                  "evm"
                                                                |);
                                                                M.read (| create_inputs |);
                                                                M.read (| outcome |)
                                                              ]
                                                            |)
                                                          |) in
                                                        M.alloc (|
                                                          M.call_closure (|
                                                            M.get_trait_method (|
                                                              "core::ops::function::Fn",
                                                              Ty.dyn
                                                                [
                                                                  ("existential predicate with variables",
                                                                    []);
                                                                  ("existential predicate with variables",
                                                                    [])
                                                                ],
                                                              [
                                                                Ty.tuple
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path "&mut")
                                                                      []
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "revm::context::Context")
                                                                          []
                                                                          [ EXT; DB ]
                                                                      ];
                                                                    Ty.apply
                                                                      (Ty.path "&mut")
                                                                      []
                                                                      [ Ty.path "revm::frame::Frame"
                                                                      ];
                                                                    Ty.path
                                                                      "revm_interpreter::interpreter_action::create_outcome::CreateOutcome"
                                                                  ]
                                                              ],
                                                              "call",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "core::ops::deref::Deref",
                                                                  Ty.apply
                                                                    (Ty.path "alloc::sync::Arc")
                                                                    []
                                                                    [
                                                                      Ty.dyn
                                                                        [
                                                                          ("existential predicate with variables",
                                                                            []);
                                                                          ("existential predicate with variables",
                                                                            [])
                                                                        ];
                                                                      Ty.path "alloc::alloc::Global"
                                                                    ],
                                                                  [],
                                                                  "deref",
                                                                  []
                                                                |),
                                                                [ old_handle ]
                                                              |);
                                                              Value.Tuple
                                                                [
                                                                  M.read (| ctx |);
                                                                  M.read (| frame |);
                                                                  M.read (| outcome |)
                                                                ]
                                                            ]
                                                          |)
                                                        |)
                                                      |)))
                                                ]
                                              |)))
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            let~ old_handle :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.dyn
                          [
                            ("existential predicate with variables", []);
                            ("existential predicate with variables", [])
                          ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| handler |),
                        "revm::handler::Handler",
                        "execution"
                      |),
                      "revm::handler::handle_types::execution::ExecutionHandler",
                      "last_frame_return"
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.write (|
                M.SubPointer.get_struct_record_field (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| handler |),
                    "revm::handler::Handler",
                    "execution"
                  |),
                  "revm::handler::handle_types::execution::ExecutionHandler",
                  "last_frame_return"
                |),
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::sync::Arc")
                      []
                      [
                        Ty.function
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "revm::context::Context") [] [ EXT; DB ] ];
                                Ty.apply (Ty.path "&mut") [] [ Ty.path "revm::frame::FrameResult" ]
                              ]
                          ]
                          (Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [
                              Ty.tuple [];
                              Ty.apply
                                (Ty.path "revm_primitives::result::EVMError")
                                []
                                [ Ty.associated ]
                            ]);
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  [
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0; α1 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let ctx := M.copy (| γ |) in
                                      M.match_operator (|
                                        M.alloc (| α1 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let frame_result := M.copy (| γ |) in
                                              M.read (|
                                                let~ inspector :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "revm::inspector::handler_register::GetInspector",
                                                        EXT,
                                                        [ DB ],
                                                        "get_inspector",
                                                        []
                                                      |),
                                                      [
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| ctx |),
                                                          "revm::context::Context",
                                                          "external"
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    frame_result,
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.read (| γ |) in
                                                          let γ1_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "revm::frame::FrameResult::Call",
                                                              0
                                                            |) in
                                                          let outcome := M.alloc (| γ1_0 |) in
                                                          let~ call_inputs :=
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.apply
                                                                    (Ty.path "core::option::Option")
                                                                    []
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "alloc::boxed::Box")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ]
                                                                    ],
                                                                  "unwrap",
                                                                  []
                                                                |),
                                                                [
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::boxed::Box")
                                                                            []
                                                                            [
                                                                              Ty.path
                                                                                "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      "pop",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::DerefMut",
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::cell::RefMut")
                                                                            []
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "alloc::vec::Vec")
                                                                                []
                                                                                [
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "alloc::boxed::Box")
                                                                                    []
                                                                                    [
                                                                                      Ty.path
                                                                                        "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                      Ty.path
                                                                                        "alloc::alloc::Global"
                                                                                    ];
                                                                                  Ty.path
                                                                                    "alloc::alloc::Global"
                                                                                ]
                                                                            ],
                                                                          [],
                                                                          "deref_mut",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.alloc (|
                                                                            M.call_closure (|
                                                                              M.get_associated_function (|
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "core::cell::RefCell")
                                                                                  []
                                                                                  [
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::vec::Vec")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "alloc::boxed::Box")
                                                                                          []
                                                                                          [
                                                                                            Ty.path
                                                                                              "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                            Ty.path
                                                                                              "alloc::alloc::Global"
                                                                                          ];
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ]
                                                                                  ],
                                                                                "borrow_mut",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.call_closure (|
                                                                                  M.get_trait_method (|
                                                                                    "core::ops::deref::Deref",
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::rc::Rc")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "core::cell::RefCell")
                                                                                          []
                                                                                          [
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "alloc::vec::Vec")
                                                                                              []
                                                                                              [
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "alloc::boxed::Box")
                                                                                                  []
                                                                                                  [
                                                                                                    Ty.path
                                                                                                      "revm_interpreter::interpreter_action::call_inputs::CallInputs";
                                                                                                    Ty.path
                                                                                                      "alloc::alloc::Global"
                                                                                                  ];
                                                                                                Ty.path
                                                                                                  "alloc::alloc::Global"
                                                                                              ]
                                                                                          ];
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ],
                                                                                    [],
                                                                                    "deref",
                                                                                    []
                                                                                  |),
                                                                                  [ call_input_stack
                                                                                  ]
                                                                                |)
                                                                              ]
                                                                            |)
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          let~ _ :=
                                                            M.write (|
                                                              M.read (| outcome |),
                                                              M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "revm::inspector::Inspector",
                                                                  Ty.associated,
                                                                  [ DB ],
                                                                  "call_end",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| inspector |);
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    M.read (| ctx |),
                                                                    "revm::context::Context",
                                                                    "evm"
                                                                  |);
                                                                  M.read (| call_inputs |);
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::clone::Clone",
                                                                      Ty.path
                                                                        "revm_interpreter::interpreter_action::call_outcome::CallOutcome",
                                                                      [],
                                                                      "clone",
                                                                      []
                                                                    |),
                                                                    [ M.read (| outcome |) ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          M.alloc (| Value.Tuple [] |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.read (| γ |) in
                                                          let γ1_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "revm::frame::FrameResult::Create",
                                                              0
                                                            |) in
                                                          let outcome := M.alloc (| γ1_0 |) in
                                                          let~ create_inputs :=
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.apply
                                                                    (Ty.path "core::option::Option")
                                                                    []
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "alloc::boxed::Box")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ]
                                                                    ],
                                                                  "unwrap",
                                                                  []
                                                                |),
                                                                [
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::boxed::Box")
                                                                            []
                                                                            [
                                                                              Ty.path
                                                                                "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      "pop",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::DerefMut",
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::cell::RefMut")
                                                                            []
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "alloc::vec::Vec")
                                                                                []
                                                                                [
                                                                                  Ty.apply
                                                                                    (Ty.path
                                                                                      "alloc::boxed::Box")
                                                                                    []
                                                                                    [
                                                                                      Ty.path
                                                                                        "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                      Ty.path
                                                                                        "alloc::alloc::Global"
                                                                                    ];
                                                                                  Ty.path
                                                                                    "alloc::alloc::Global"
                                                                                ]
                                                                            ],
                                                                          [],
                                                                          "deref_mut",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.alloc (|
                                                                            M.call_closure (|
                                                                              M.get_associated_function (|
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "core::cell::RefCell")
                                                                                  []
                                                                                  [
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::vec::Vec")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "alloc::boxed::Box")
                                                                                          []
                                                                                          [
                                                                                            Ty.path
                                                                                              "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                            Ty.path
                                                                                              "alloc::alloc::Global"
                                                                                          ];
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ]
                                                                                  ],
                                                                                "borrow_mut",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.call_closure (|
                                                                                  M.get_trait_method (|
                                                                                    "core::ops::deref::Deref",
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::rc::Rc")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "core::cell::RefCell")
                                                                                          []
                                                                                          [
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "alloc::vec::Vec")
                                                                                              []
                                                                                              [
                                                                                                Ty.apply
                                                                                                  (Ty.path
                                                                                                    "alloc::boxed::Box")
                                                                                                  []
                                                                                                  [
                                                                                                    Ty.path
                                                                                                      "revm_interpreter::interpreter_action::create_inputs::CreateInputs";
                                                                                                    Ty.path
                                                                                                      "alloc::alloc::Global"
                                                                                                  ];
                                                                                                Ty.path
                                                                                                  "alloc::alloc::Global"
                                                                                              ]
                                                                                          ];
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ],
                                                                                    [],
                                                                                    "deref",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    create_input_stack
                                                                                  ]
                                                                                |)
                                                                              ]
                                                                            |)
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          let~ _ :=
                                                            M.write (|
                                                              M.read (| outcome |),
                                                              M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "revm::inspector::Inspector",
                                                                  Ty.associated,
                                                                  [ DB ],
                                                                  "create_end",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| inspector |);
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    M.read (| ctx |),
                                                                    "revm::context::Context",
                                                                    "evm"
                                                                  |);
                                                                  M.read (| create_inputs |);
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::clone::Clone",
                                                                      Ty.path
                                                                        "revm_interpreter::interpreter_action::create_outcome::CreateOutcome",
                                                                      [],
                                                                      "clone",
                                                                      []
                                                                    |),
                                                                    [ M.read (| outcome |) ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          M.alloc (| Value.Tuple [] |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.read (| γ |) in
                                                          let γ1_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "revm::frame::FrameResult::EOFCreate",
                                                              0
                                                            |) in
                                                          let outcome := M.alloc (| γ1_0 |) in
                                                          let~ eofcreate_inputs :=
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.apply
                                                                    (Ty.path "core::option::Option")
                                                                    []
                                                                    [
                                                                      Ty.path
                                                                        "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput"
                                                                    ],
                                                                  "unwrap",
                                                                  []
                                                                |),
                                                                [
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      "pop",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::DerefMut",
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "core::cell::RefMut")
                                                                            []
                                                                            [
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "alloc::vec::Vec")
                                                                                []
                                                                                [
                                                                                  Ty.path
                                                                                    "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                                                                  Ty.path
                                                                                    "alloc::alloc::Global"
                                                                                ]
                                                                            ],
                                                                          [],
                                                                          "deref_mut",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.alloc (|
                                                                            M.call_closure (|
                                                                              M.get_associated_function (|
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "core::cell::RefCell")
                                                                                  []
                                                                                  [
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::vec::Vec")
                                                                                      []
                                                                                      [
                                                                                        Ty.path
                                                                                          "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ]
                                                                                  ],
                                                                                "borrow_mut",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.call_closure (|
                                                                                  M.get_trait_method (|
                                                                                    "core::ops::deref::Deref",
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::rc::Rc")
                                                                                      []
                                                                                      [
                                                                                        Ty.apply
                                                                                          (Ty.path
                                                                                            "core::cell::RefCell")
                                                                                          []
                                                                                          [
                                                                                            Ty.apply
                                                                                              (Ty.path
                                                                                                "alloc::vec::Vec")
                                                                                              []
                                                                                              [
                                                                                                Ty.path
                                                                                                  "revm_interpreter::interpreter_action::eof_create_inputs::EOFCreateInput";
                                                                                                Ty.path
                                                                                                  "alloc::alloc::Global"
                                                                                              ]
                                                                                          ];
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ],
                                                                                    [],
                                                                                    "deref",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    eofcreate_input_stack
                                                                                  ]
                                                                                |)
                                                                              ]
                                                                            |)
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          let~ _ :=
                                                            M.write (|
                                                              M.read (| outcome |),
                                                              M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "revm::inspector::Inspector",
                                                                  Ty.associated,
                                                                  [ DB ],
                                                                  "eofcreate_end",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| inspector |);
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    M.read (| ctx |),
                                                                    "revm::context::Context",
                                                                    "evm"
                                                                  |);
                                                                  eofcreate_inputs;
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::clone::Clone",
                                                                      Ty.path
                                                                        "revm_interpreter::interpreter_action::eof_create_outcome::EOFCreateOutcome",
                                                                      [],
                                                                      "clone",
                                                                      []
                                                                    |),
                                                                    [ M.read (| outcome |) ]
                                                                  |)
                                                                ]
                                                              |)
                                                            |) in
                                                          M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::function::Fn",
                                                      Ty.dyn
                                                        [
                                                          ("existential predicate with variables",
                                                            []);
                                                          ("existential predicate with variables",
                                                            [])
                                                        ],
                                                      [
                                                        Ty.tuple
                                                          [
                                                            Ty.apply
                                                              (Ty.path "&mut")
                                                              []
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "revm::context::Context")
                                                                  []
                                                                  [ EXT; DB ]
                                                              ];
                                                            Ty.apply
                                                              (Ty.path "&mut")
                                                              []
                                                              [ Ty.path "revm::frame::FrameResult" ]
                                                          ]
                                                      ],
                                                      "call",
                                                      []
                                                    |),
                                                    [
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::deref::Deref",
                                                          Ty.apply
                                                            (Ty.path "alloc::sync::Arc")
                                                            []
                                                            [
                                                              Ty.dyn
                                                                [
                                                                  ("existential predicate with variables",
                                                                    []);
                                                                  ("existential predicate with variables",
                                                                    [])
                                                                ];
                                                              Ty.path "alloc::alloc::Global"
                                                            ],
                                                          [],
                                                          "deref",
                                                          []
                                                        |),
                                                        [ old_handle ]
                                                      |);
                                                      Value.Tuple
                                                        [
                                                          M.read (| ctx |);
                                                          M.read (| frame_result |)
                                                        ]
                                                    ]
                                                  |)
                                                |)
                                              |)))
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_inspector_handle_register :
      M.IsFunction
        "revm::inspector::handler_register::inspector_handle_register"
        inspector_handle_register.
    
    (*
    pub fn inspector_instruction<
        'a,
        INSP: GetInspector<DB>,
        DB: Database,
        Instruction: Fn(&mut Interpreter, &mut Evm<'a, INSP, DB>) + 'a,
    >(
        instruction: Instruction,
    ) -> BoxedInstruction<'a, Evm<'a, INSP, DB>> {
        Box::new(
            move |interpreter: &mut Interpreter, host: &mut Evm<'a, INSP, DB>| {
                // SAFETY: as the PC was already incremented we need to subtract 1 to preserve the
                // old Inspector behavior.
                interpreter.instruction_pointer = unsafe { interpreter.instruction_pointer.sub(1) };
    
                host.context
                    .external
                    .get_inspector()
                    .step(interpreter, &mut host.context.evm);
                if interpreter.instruction_result != InstructionResult::Continue {
                    return;
                }
    
                // return PC to old value
                interpreter.instruction_pointer = unsafe { interpreter.instruction_pointer.add(1) };
    
                // execute instruction.
                instruction(interpreter, host);
    
                host.context
                    .external
                    .get_inspector()
                    .step_end(interpreter, &mut host.context.evm);
            },
        )
    }
    *)
    Definition inspector_instruction (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ INSP; DB; Instruction ], [ instruction ] =>
        ltac:(M.monadic
          (let instruction := M.alloc (| instruction |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::boxed::Box")
                []
                [
                  Ty.function
                    [
                      Ty.tuple
                        [
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.path "revm_interpreter::interpreter::Interpreter" ];
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.apply (Ty.path "revm::evm::Evm") [] [ INSP; DB ] ]
                        ]
                    ]
                    (Ty.tuple []);
                  Ty.path "alloc::alloc::Global"
                ],
              "new",
              []
            |),
            [
              M.closure
                (fun γ =>
                  ltac:(M.monadic
                    match γ with
                    | [ α0; α1 ] =>
                      ltac:(M.monadic
                        (M.match_operator (|
                          M.alloc (| α0 |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let interpreter := M.copy (| γ |) in
                                M.match_operator (|
                                  M.alloc (| α1 |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let host := M.copy (| γ |) in
                                        M.read (|
                                          let~ _ :=
                                            M.write (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| interpreter |),
                                                "revm_interpreter::interpreter::Interpreter",
                                                "instruction_pointer"
                                              |),
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply (Ty.path "*const") [] [ Ty.path "u8" ],
                                                  "sub",
                                                  []
                                                |),
                                                [
                                                  M.read (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| interpreter |),
                                                      "revm_interpreter::interpreter::Interpreter",
                                                      "instruction_pointer"
                                                    |)
                                                  |);
                                                  Value.Integer IntegerKind.Usize 1
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "revm::inspector::Inspector",
                                                  Ty.associated,
                                                  [ DB ],
                                                  "step",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "revm::inspector::handler_register::GetInspector",
                                                      INSP,
                                                      [ DB ],
                                                      "get_inspector",
                                                      []
                                                    |),
                                                    [
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| host |),
                                                          "revm::evm::Evm",
                                                          "context"
                                                        |),
                                                        "revm::context::Context",
                                                        "external"
                                                      |)
                                                    ]
                                                  |);
                                                  M.read (| interpreter |);
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| host |),
                                                      "revm::evm::Evm",
                                                      "context"
                                                    |),
                                                    "revm::context::Context",
                                                    "evm"
                                                  |)
                                                ]
                                              |)
                                            |) 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
                                                                "revm_interpreter::instruction_result::InstructionResult",
                                                              [
                                                                Ty.path
                                                                  "revm_interpreter::instruction_result::InstructionResult"
                                                              ],
                                                              "ne",
                                                              []
                                                            |),
                                                            [
                                                              M.SubPointer.get_struct_record_field (|
                                                                M.read (| interpreter |),
                                                                "revm_interpreter::interpreter::Interpreter",
                                                                "instruction_result"
                                                              |);
                                                              M.alloc (|
                                                                Value.StructTuple
                                                                  "revm_interpreter::instruction_result::InstructionResult::Continue"
                                                                  []
                                                              |)
                                                            ]
                                                          |)
                                                        |)) 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.Tuple [] |) |)
                                                      |)
                                                    |)));
                                                fun γ =>
                                                  ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          let~ _ :=
                                            M.write (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| interpreter |),
                                                "revm_interpreter::interpreter::Interpreter",
                                                "instruction_pointer"
                                              |),
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply (Ty.path "*const") [] [ Ty.path "u8" ],
                                                  "add",
                                                  []
                                                |),
                                                [
                                                  M.read (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| interpreter |),
                                                      "revm_interpreter::interpreter::Interpreter",
                                                      "instruction_pointer"
                                                    |)
                                                  |);
                                                  Value.Integer IntegerKind.Usize 1
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::Fn",
                                                  Instruction,
                                                  [
                                                    Ty.tuple
                                                      [
                                                        Ty.apply
                                                          (Ty.path "&mut")
                                                          []
                                                          [
                                                            Ty.path
                                                              "revm_interpreter::interpreter::Interpreter"
                                                          ];
                                                        Ty.apply
                                                          (Ty.path "&mut")
                                                          []
                                                          [
                                                            Ty.apply
                                                              (Ty.path "revm::evm::Evm")
                                                              []
                                                              [ INSP; DB ]
                                                          ]
                                                      ]
                                                  ],
                                                  "call",
                                                  []
                                                |),
                                                [
                                                  instruction;
                                                  Value.Tuple
                                                    [ M.read (| interpreter |); M.read (| host |) ]
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "revm::inspector::Inspector",
                                                  Ty.associated,
                                                  [ DB ],
                                                  "step_end",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "revm::inspector::handler_register::GetInspector",
                                                      INSP,
                                                      [ DB ],
                                                      "get_inspector",
                                                      []
                                                    |),
                                                    [
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| host |),
                                                          "revm::evm::Evm",
                                                          "context"
                                                        |),
                                                        "revm::context::Context",
                                                        "external"
                                                      |)
                                                    ]
                                                  |);
                                                  M.read (| interpreter |);
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| host |),
                                                      "revm::evm::Evm",
                                                      "context"
                                                    |),
                                                    "revm::context::Context",
                                                    "evm"
                                                  |)
                                                ]
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)
                                        |)))
                                  ]
                                |)))
                          ]
                        |)))
                    | _ => M.impossible "wrong number of arguments"
                    end))
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_inspector_instruction :
      M.IsFunction "revm::inspector::handler_register::inspector_instruction" inspector_instruction.
  End handler_register.
End inspector.
