"""Find indirect calls to service-interface slot +0xe0 and compare contracts."""

PATTERNS = (
    bytes.fromhex("ff 90 e0 00 00 00"),
    bytes.fromhex("ff 91 e0 00 00 00"),
    bytes.fromhex("ff 92 e0 00 00 00"),
    bytes.fromhex("ff 93 e0 00 00 00"),
    bytes.fromhex("ff 96 e0 00 00 00"),
    bytes.fromhex("ff 97 e0 00 00 00"),
    bytes.fromhex("41 ff 90 e0 00 00 00"),
    bytes.fromhex("41 ff 91 e0 00 00 00"),
    bytes.fromhex("41 ff 92 e0 00 00 00"),
    bytes.fromhex("41 ff 93 e0 00 00 00"),
)

seen = set()
for pattern in PATTERNS:
    for hit in find_all(pattern, blocks=(".text",)):
        owner = func(hit)
        if owner is None:
            continue
        entry = int(owner.getEntryPoint().getOffset())
        if entry in seen:
            continue
        seen.add(entry)
        print("\n===== call %#x function %#x %s =====" %
              (hit, entry, owner.getName()))
        print(dec(owner, 120)[:12000])
        print("callees", callees(owner)[:80])

