"""Adversarial verify Dimension 4/5 decompile claims.
Hypothesis under attack:
 (A) FUN_1800b2680 case 0xc reads slot+0x2c8 -> GOTO_DRAFT_ONLINE/DISABLED;
     case 0xd reads slot+0x2d0 AND +0x2c8 -> GOTO_DRAFT_OFFLINE/DISABLED;
     cases 5/0xe (tournament) set GOTO_* UNCONDITIONALLY;
     objectives block reads slot 0x320 -> GOTO_MANAGER_QUEST(_DISABLED).
 (B) settings deser FUN_18013c6d0: 0xf9->[0x17]; 0xfa&0xff->[0x18]; 0xfd&0xfe->[0x1c].
 (C) applier FUN_18011dc50: +0x1fd3d=[0x17]==1; +0x1fd3e=[0x18]==1; +0x1fd44=[0x1c]==1.
 (D) feature FUN_18013ec10 arm 0x11c recognizes ONLY atom 0x330.
Control: settings 0x336 tradingEnabled -> [10]; applier +0x1fd2e=[10]==1 (known good).
Method: print full decompile length + context around each token so absence claims
are from FULL text, not truncation.
"""
import traceback
def ctx(txt, needles, before=2, after=6):
    lines=txt.splitlines()
    hits=set()
    for i,l in enumerate(lines):
        for n in needles:
            if n in l:
                for j in range(max(0,i-before), min(len(lines),i+after+1)):
                    hits.add(j)
    for j in sorted(hits):
        print("  %4d: %s"%(j,lines[j]))
try:
    for ea,name,needles in [
        (0x1800b2680,"FUN_1800b2680 (hub tile builder)",
         ["GOTO_DRAFT","GOTO_MANAGER_QUEST","GOTO_OFFLINE_TOURNAMENT","GOTO_ONLINE_CHAMPIONS",
          "GOTO_OFFLINE_SEASON","GOTO_ONLINE_SEASON","0x2c8","0x2d0","0x320","0x2b8",
          "SBS","GameHub_SBS","0xd0)","GOTO_SBC","GOTO_SQUAD"]),
        (0x18013c6d0,"FUN_18013c6d0 (settings deser)",
         ["0xf9","0xfa","0xff","0xfd","0xfe","0x336","0x17]","0x18]","0x1c]","[10]","param_2[10]"]),
        (0x18011dc50,"FUN_18011dc50 (applier)",None),
        (0x18013ec10,"FUN_18013ec10 (feature/massinfo)",
         ["0x11c","0x330","0x336"]),
    ]:
        c=dec(ea)
        print("="*70)
        print("%s  len=%d"%(name,len(c)))
        if needles is None:
            print(c)
        else:
            ctx(c,needles)
except Exception:
    traceback.print_exc()
