"""DIMENSION 4 q7 (Q2 rigor): trace the three draft settings atoms 0xf9/0xfa/0xff
through the settings deser FUN_18013c6d0 to struct fields, and through the applier
FUN_18011dc50 to gate bytes +0x1fd3d / +0x1fd3e. Also enumerate ALL native readers
of the two draft gate bytes to confirm the tile builder is the only consumer.

Control: applier must contain a write to +0x1fd2e gated on (field==1) (IS_TRADING,
established). Print applier + deser in full (lengths printed) to avoid truncation.
"""
import traceback
try:
    d = dec(0x18011dc50)
    print("=== applier FUN_18011dc50 len=%d ===" % len(d))
    print(d)
    d2 = dec(0x18013c6d0)
    print("\n=== settings deser FUN_18013c6d0 len=%d ===" % len(d2))
    print(d2)

    # native readers of the two draft gate bytes: scan .text for movzx/cmp/mov disp32
    import struct as _s
    print("\n=== raw disp32 sites for 0x1fd3d and 0x1fd3e in .text ===")
    for disp in (0x1fd3d, 0x1fd3e):
        pat = _s.pack("<i", disp)
        hits = find_all(pat, (".text",))
        for h in hits:
            fn = fname(h)
            print("  disp %#x referenced @%#x in %s" % (disp, h, fn))
except Exception:
    traceback.print_exc()
print("QUERY_DONE")
