code: def remove_end_optionals(ir_blocks):
      
      new_ir_blocks = []
      for block in ir_blocks:
          if not isinstance(block, EndOptional):
              new_ir_blocks.append(block)
      return new_ir_blocks
docs: Return a list of IR blocks as a copy of the original, with EndOptional blocks removed.