"""DIM4 Q1/Q2. Find the REQUEST BUILDER for each market op by xref'ing the per-op
path-suffix format literal found in .rdata next to each RS4 response-class name,
then decompile the containing function (that is where the query string is built and,
for POST/PUT ops, where the request body is serialized).

Also re-read the auctionInfo record deser 0x18013e410 and the shared IS-list body
0x18013e7f0 IN FULL (len printed) so the atom set can be confirmed, not inherited.

CONTROL for the xref method: '/relist' (0x1802289a8) must land in a function that
also references route index 0 / 'ut/%s/auctionhouse'-derived state; and the record
deser must show the 12 atoms already documented at HIGH confidence in ENDPOINT_MAP.
A control that reproduces the known 12 validates the read for the unknown ones.
"""
import traceback
try:
    LITS = [
        ("/transfermarket?type=%s&start=%d&num=%d", 0x180228490),
        ("&definitionId=%d",                        0x1802284c8),
        ("/counts",                                 0x180228718),
        ("/pricelimits",                            0x1802288a8),
        ("/relist",                                 0x1802289a8),
        ("/status?tradeIds=%lld",                   0x180228ae0),
        ("/sold",                                   0x180228bec),
        ("?tradeId=%lld",                           0x180228d18),
        ("/%lld/offer",                             0x180228fc0),
        ("/expired",                                0x1802290c8),
        ("?tradeId=",                               0x1802290d8),
        ("?offset=%d&count=%d",                     0x180229390),
        ("Auction state is invalid for bidding",    0x180228f80),
    ]
    seen = {}
    for nm, a in LITS:
        print("\n===== XREFS to %r %#x =====" % (nm, a))
        xs = xrefs_to(a)
        if not xs:
            print("  (none direct) trying a-4 (RS4 rule n/a here, but try anyway)")
            xs = xrefs_to(a - 4)
        for frm, typ, fn, ent in xs:
            print("   from %#x %s in %s @ %#x" % (frm, typ, fn, ent))
            if ent:
                seen.setdefault(ent, set()).add(nm)
    for ent, tags in sorted(seen.items()):
        print("\n########## BUILDER %#x  (lits: %s) ##########" % (ent, sorted(tags)))
        s = dec(ent)
        print("len(src)=%d" % len(s))
        print(s)
except Exception:
    traceback.print_exc()
