code: def generate_tier1(
      filenames: list[str],
      analysis: Analysis,
      outfile: TextIO,
      lines: bool,
  ) -> None:
      write_header(__file__, filenames, outfile)
      outfile.write(
          """
  #ifdef TIER_TWO
      #error "This file is for Tier 1 only"
  #endif
  #define TIER_ONE 1
  """
      )
      out = CWriter(outfile, 2, lines)
      out.emit("\n")
      for name, inst in sorted(analysis.instructions.items()):
          needs_this = uses_this(inst)
          out.emit("\n")
          out.emit(f"TARGET({name}) {{\n")
          if needs_this and not inst.is_target:
              out.emit(
                  f"_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;\n"
              )
          else:
              out.emit(f"frame->instr_ptr = next_instr;\n")
          out.emit(f"next_instr += {inst.size};\n")
          out.emit(f"INSTRUCTION_STATS({name});\n")
          if inst.is_target:
              out.emit(f"PREDICTED({name});\n")
              if needs_this:
                  out.emit(
                      f"_Py_CODEUNIT *this_instr = next_instr - {inst.size};\n"
                  )
          if inst.family is not None:
              out.emit(
                  f"static_assert({inst.family.size} == {inst.size-1}"
                  ', "incorrect cache size");\n'
              )
          declare_variables(inst, out)
          offset = 1  # The instruction itself
          stack = Stack()
          for part in inst.parts:
              # Only emit braces if more than one uop
              insert_braces = (
                  len([p for p in inst.parts if isinstance(p, Uop)]) > 1
              )
              offset = write_uop(
                  part, out, offset, stack, inst, insert_braces
              )
          out.start_line()
          if not inst.parts[-1].properties.always_exits:
              stack.flush(out)
              if inst.parts[-1].properties.ends_with_eval_breaker:
                  out.emit("CHECK_EVAL_BREAKER();\n")
              out.emit("DISPATCH();\n")
          out.start_line()
          out.emit("}")
          out.emit("\n")
      outfile.write(FOOTER)
  
file_path: cpython/Tools/cases_generator/tier1_generator.py
imports: import argparse
  import os.path
  import sys
  from analyzer import Analysis, Instruction, Uop, Part, analyze_files, Skip, StackItem, analysis_error
  from generators_common import DEFAULT_INPUT, ROOT, write_header, emit_tokens
  from cwriter import CWriter
  from typing import TextIO, Iterator
  from lexer import Token
  from stack import StackOffset, Stack, SizeMismatch
label_desc: Use image node_id 4 for calling a global function with example usage: generate_tier1(filenames, analysis, outfile, lines) without return types