"""Find completion callbacks that test the same status field at response+0x1c.""" patterns = ( bytes.fromhex("83 7a 1c 00"), # cmp dword ptr [rdx+1c],0 bytes.fromhex("83 79 1c 00"), # cmp dword ptr [rcx+1c],0 bytes.fromhex("83 78 1c 00"), # cmp dword ptr [rax+1c],0 ) seen = set() for pattern in patterns: print("\npattern", pattern.hex()) for hit in find_all(pattern): f = func(hit) if f is None: continue entry = int(f.getEntryPoint().getOffset()) if entry in seen: continue seen.add(entry) print("\n=== hit %#x function %#x %s ===" % (hit, entry, f.getName())) print(dec(f, 180)[:5000])