"""DIMENSION 5 pass 8: the pack-record -> view-model translator, which is the consumer
of unopened(0x35d).

Found in the raw disassembly, not the decompiler: at 0x18002c7ea..0x18002c816 a
function copies BYTE [rbp+0xce] -> [rsi+0xb8] and BYTE [rbp+0xcd] -> [rsi+0x69],
where rbp is the 0x158-byte parsed pack record (it also reads +0x144/+0x148/+0x14c/
+0x150/+0x154, all inside 0x158) and rsi is a wider destination struct.

Per pass 1's offset rule (record_off = 0x268 - N in FUN_18013af30, controlled twice by
displayGroupAssetId->+0x30 and displayGroupUseDefaultImage->+0x38), +0xcd is
unopened(0x35d) and +0xce is isPremium(0x176).

CONTROL: the same routine must also move a field whose meaning is already known from
the deserializer, so the "rbp is the pack record" reading is testable. start(0x2e3) is
at record+0xb4 and the routine moves DWORD [rbp+0xb4] -> [rsi+0x84]; sortPriority
(0x2cb) is at record+0x7c and displayGroupAssetId at +0x30.
"""
import traceback, os
OUT = "/tmp/claude-1000/-home-alex-Documents-OpenFUT/8e521ca1-ca3e-4138-bb96-df1744dd1d30/scratchpad/store"
try:
    f = func(0x18002c7ea)
    ent = int(f.getEntryPoint().getOffset())
    print("containing function %s @ %#x  body %#x-%#x" % (
        f.getName(), ent, ent, int(f.getBody().getMaxAddress().getOffset())))
    s = dec(ent, 300)
    open(os.path.join(OUT, "dec_translator_%x.c" % ent), "w").write(s)
    print("declen=%d -> dec_translator_%x.c" % (len(s), ent))
    print(s if len(s) < 12000 else s[:12000])
    print("\n### callers")
    for frm, typ, fn, e2 in xrefs_to(ent):
        print("  from %#x (%s) in %s @ %#x" % (frm, typ, fn, e2))
except Exception:
    traceback.print_exc()
