docstr: Codegen based off of:
  with ctx(args):
      (rest)
docstr_tok: ["Codegen","based","off","of",":","with","ctx","(","args",")",":","(","rest",")"]
code: def __call__(self, code_options, cleanup):
      """
      Codegen based off of:
      with ctx(args):
          (rest)
      """
      load_args = []
      if self.target_values:
          load_args = [
              create_instruction("LOAD_CONST", argval=val)
              for val in self.target_values
          ]
      if sys.version_info < (3, 9):
          with_cleanup_start = create_instruction("WITH_CLEANUP_START")
          begin_finally = create_instruction("BEGIN_FINALLY")
          cleanup[:] = [
              create_instruction("POP_BLOCK"),
              begin_finally,
              with_cleanup_start,
              create_instruction("WITH_CLEANUP_FINISH"),
              create_instruction("END_FINALLY"),
          ] + cleanup
  
          return [
              *load_args,
              create_instruction("CALL_FUNCTION", arg=len(load_args)),
              create_instruction(
                  "SETUP_WITH", target=with_cleanup_start
              ),
              create_instruction("POP_TOP"),
          ], None
      elif sys.version_info < (3, 11):
          with_except_start = create_instruction("WITH_EXCEPT_START")
          pop_top_after_with_except_start = create_instruction(
              "POP_TOP"
          )
  
          cleanup_complete_jump_target = create_instruction("NOP")
  
          cleanup[:] = [
              create_instruction("POP_BLOCK"),
              create_instruction("LOAD_CONST", argval=None),
              create_instruction("DUP_TOP"),
              create_instruction("DUP_TOP"),
              create_instruction("CALL_FUNCTION", arg=3),
              create_instruction("POP_TOP"),
              create_instruction(
                  "JUMP_FORWARD", target=cleanup_complete_jump_target
              ),
              with_except_start,
              create_instruction(
                  "POP_JUMP_IF_TRUE",
                  target=pop_top_after_with_except_start,
              ),
              create_instruction("RERAISE"),
              pop_top_after_with_except_start,
              create_instruction("POP_TOP"),
              create_instruction("POP_TOP"),
              create_instruction("POP_EXCEPT"),
              create_instruction("POP_TOP"),
              cleanup_complete_jump_target,
          ] + cleanup
  
          return [
              *load_args,
              create_instruction("CALL_FUNCTION", arg=len(load_args)),
              create_instruction(
                  "SETUP_WITH", target=with_except_start
              ),
              create_instruction("POP_TOP"),
          ], None
      else:
          pop_top_after_with_except_start = create_instruction(
              "POP_TOP"
          )
          cleanup_complete_jump_target = create_instruction("NOP")
  
          def create_load_none():
              return create_instruction("LOAD_CONST", argval=None)
  
          exn_tab_1_begin = create_instruction("POP_TOP")
          exn_tab_1_end = create_instruction("NOP")
          exn_tab_1_target = create_instruction("PUSH_EXC_INFO")
          exn_tab_2_end = create_instruction("RERAISE", arg=2)
          exn_tab_2_target = create_instruction("COPY", arg=3)
  
          exn_tab_1_begin.exn_tab_entry = InstructionExnTabEntry(
              exn_tab_1_begin,
              exn_tab_1_end,
              exn_tab_1_target,
              self.stack_index + 1,
              True,
          )
          exn_tab_1_target.exn_tab_entry = InstructionExnTabEntry(
              exn_tab_1_target,
              exn_tab_2_end,
              exn_tab_2_target,
              self.stack_index + 3,
              True,
          )
          pop_top_after_with_except_start.exn_tab_entry = (
              InstructionExnTabEntry(
                  pop_top_after_with_except_start,
                  pop_top_after_with_except_start,
                  exn_tab_2_target,
                  self.stack_index + 3,
                  True,
              )
          )
  
          cleanup[:] = [
              exn_tab_1_end,
              create_load_none(),
              create_load_none(),
              create_load_none(),
              *create_call_function(2, False),
              create_instruction("POP_TOP"),
              create_instruction(
                  "JUMP_FORWARD", target=cleanup_complete_jump_target
              ),
              exn_tab_1_target,  # PUSH_EXC_INFO
              create_instruction("WITH_EXCEPT_START"),
              create_instruction(
                  "POP_JUMP_FORWARD_IF_TRUE",
                  target=pop_top_after_with_except_start,
              ),
              exn_tab_2_end,  # RERAISE 2
              exn_tab_2_target,  # COPY 3
              create_instruction("POP_EXCEPT"),
              create_instruction("RERAISE", arg=1),
              pop_top_after_with_except_start,
              create_instruction("POP_EXCEPT"),
              create_instruction("POP_TOP"),
              create_instruction("POP_TOP"),
              cleanup_complete_jump_target,
          ] + cleanup
  
          return [
              *load_args,
              *create_call_function(len(load_args), True),
              create_instruction("BEFORE_WITH"),
              exn_tab_1_begin,  # POP_TOP
          ], exn_tab_1_target
  
file_path: pytorch/torch/_dynamo/resume_execution.py
imports: import copy
  import dataclasses
  import sys
  import types
  from typing import Any, cast, Dict, List, Optional, Tuple
  from .bytecode_transformation import create_call_function, create_call_method, create_dup_top, create_instruction, create_jump_absolute, Instruction, InstructionExnTabEntry, transform_code_object, unique_id
  from .utils import ExactWeakKeyDictionary
label_desc: Use image node_id 2 for calling the ReenterWith obj's underlying member method code with example usage: obj.__call__(code_options, cleanup) and returns: list,  None, list,  None, list,  exn_tab_1_target, create_instruction