import sys,pickle,collections
sys.path.insert(0,'/tmp/claude-0/-root-ants/f0a0d69c-fbe4-4887-8c0d-a5302a0da398/scratchpad')
from arm import *
img={S(im[0]):(im[2],im[3]) for im in IMAGES}
X=collections.defaultdict(list)     # literal -> [method fullname]
MSTR={}                             # method fullname -> [literals]
for asm in ['Assembly-CSharp.dll','Assembly-CSharp-firstpass.dll']:
    st,ct=img[asm]
    for i in range(st,st+ct):
        t=TYPES[i]; ns,nm=S(t[1]),S(t[0])
        cls=(ns+'.' if ns else '')+nm
        for k in range(t[20]):
            m=METHODS[t[13]+k]
            a=method_addr(m[6]); sz=fn_size(a)
            if sz<=0: continue
            ls=method_lits(a,sz)
            if not ls: continue
            fn='%s::%s'%(cls,S(m[0]))
            MSTR[fn]=(a,ls)
            for s in ls: X[s].append(fn)
pickle.dump((dict(X),MSTR),open('/tmp/claude-0/-root-ants/f0a0d69c-fbe4-4887-8c0d-a5302a0da398/scratchpad/xref.pkl','wb'))
print('literals referenced:',len(X),' methods with strings:',len(MSTR))
