# Path: xform.py



import sys
import argparse
import core
import dot
from parser import *
from xform import foreach_inst


class AsmPrinter(CFGPrinter):

    def __init__(self, cfg, stream=sys.stdout):
        super().__init__(cfg, stream)
        self.addr_width = 8
        self.inst_indent = 4
        self.no_dead = False

        self.inst_printer = self.print_with_addr
        self.referenced_labels = set()
        self.get_jump_labels()

    def format_addr(self, addr, extra=0):
        return addr.ljust(self.addr_width + extra)

    def get_jump_labels(self):
        def collect_labels(inst):
            assert isinstance(inst, Inst), "Perhaps, this is structured CFG? Use --format=c for output."
            addr = inst.jump_addr()
            if isinstance(addr, list):
                self.referenced_labels.update(addr)
            elif addr is not None:
                self.referenced_labels.add(addr)

# Path: xform.py



# Path: asmprinter.py
import sys
import argparse
import core
import dot
from parser import *
from xform import foreach_inst



class AsmPrinter(CFGPrinter):

    def __init__(self, cfg, stream=sys.stdout):
        super().__init__(cfg, stream)
        self.addr_width = 8
        self.inst_indent = 4
        self.no_dead = False

        self.inst_printer = self.print_with_addr
        self.referenced_labels = set()
        self.get_jump_labels()

    def format_addr(self, addr, extra=0):
        return addr.ljust(self.addr_width + extra)

    def get_jump_labels(self):
        def collect_labels(inst):
            assert isinstance(inst, Inst), "Perhaps, this is structured CFG? Use --format=c for output."
            addr = inst.jump_addr()
            if isinstance(addr, list):
                self.referenced_labels.update(addr)
            elif addr is not None:
                self.referenced_labels.add(addr)

        foreach_inst(self.cfg, collect_labels)