def determine_main_call_site(libc, symbols):
    for printer in ['print_main_call_site_64', 'print_main_call_site_32']:
        printer = os.path.join(os.path.dirname(os.path.realpath(__file__)), printer)
        try:
            output = subprocess.check_output('LD_PRELOAD=%s %s' % (libc, printer), shell=True, stderr=subprocess.STDOUT)
            [(main_call_site, printf)] = re.findall('^0x([0-9a-fA-F]*) 0x([0-9a-fA-F]*)$', output)
            (main_call_site, printf) = (int(main_call_site, 16), int(printf, 16))
            print libc, main_call_site, printf
            symbols['main_call_site'] = symbols['printf'] + (printf - main_call_site)
            return symbols
        except subprocess.CalledProcessError:
            pass
        except ValueError:
            pass
dataset/ETHPy150Open molnarg/libc-binary-collection/tools/extract_main_call_sites.py/determine_main_call_site/swapped operands of `-`