import argparse
import re
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("path", type=str, help="Input file path")
args = parser.parse_args()
regex = r"(\:\n)(.*?)(^[^\n]+\n[^\n]+result_.*?\n\n)"
subst = "\\g<1>\\g<2>\\g<3>"
with open(args.path, 'rt') as f:
text = f.read()
outp_flag = "Disassembly of section .text" not in text
text = text.replace('\t', ' ' * 4)
text = text.replace('>', '>')
text = text.replace('<', '<')
text = re.sub(regex, subst, text, 0, re.MULTILINE | re.DOTALL)
text = re.sub(r" +", " ", text, 0, re.MULTILINE | re.DOTALL)
print('')
for line in text.splitlines():
if outp_flag:
print(line + '
')
if "Disassembly of section .text:" in line:
outp_flag = True
print('')
if __name__ == "__main__":
main()