"""ADVERSARIAL Q4. Where is the +0x1a0 (sortPriority) merge sort actually used, and
what does the 0x1a8 ctor leave in +0x1a0 / +0x94 for GROUP TILES (FUN_180014610 sets
neither)? Also FUN_180012950 and FUN_180014380 in full for the group-key claim."""
import sys, traceback
OUT = "/tmp/claude-1000/-home-alex-Documents-OpenFUT/8e521ca1-ca3e-4138-bb96-df1744dd1d30/scratchpad/store/adv/q4_out.txt"
try:
    fh = open(OUT, "w")
    def P(*a):
        s = " ".join(str(x) for x in a)
        print(s); fh.write(s + "\n")
    P("=== callers of FUN_180010cd0 (the merge-sort driver over +0x1a0) ===")
    for frm, typ, fn, ent in xrefs_to(0x180010cd0):
        P("   from %#x %s in %s @ %#x" % (frm, typ, fn, ent))
    P("=== callers of FUN_180010890 ===")
    for frm, typ, fn, ent in xrefs_to(0x180010890):
        P("   from %#x %s in %s @ %#x" % (frm, typ, fn, ent))
    for t in (0x1800130c0, 0x180012950, 0x180014380, 0x180010cd0):
        f = func(t)
        P()
        P("======== DECOMPILE %s @ %#x ========" % (f.getName() if f else "?", t))
        src = dec(t, 300)
        P("len(src) =", len(src))
        P(src)
        P("======== END %#x ========" % t)
    fh.close()
except Exception:
    traceback.print_exc()
    try: fh.close()
    except Exception: pass
