from pathlib import Path import json,re,hashlib,struct,subprocess root=Path('reports/os-implementation/K2100-timer-frame-flags-review-3bez228o');r=json.loads((root/'report.json').read_text());frame=struct.unpack('<36Q',Path(r['frame']['path']).read_bytes());old=(root/'original.rs').read_text();new=(root/'corrected.rs').read_text() extract=lambda s:re.search(r'frame\[33\][^\n]*?!=0x345',s).group(0) a,b=extract(old),extract(new) source=f'''fn old(spsr:u64)->bool{{let mut frame=[0u64;36];frame[33]=spsr;!({a})}} fn new(spsr:u64)->bool{{let mut frame=[0u64;36];frame[33]=spsr;!({b})}} fn main(){{assert!(!old({frame[33]}));assert!(new({frame[33]}));let mut positive=0;let mut negative=0;for nzcv in 0..16{{for tco in 0..2{{assert!(new(0x345|(nzcv<<28)|(tco<<25)));positive+=1;}}}}for bit in (0..28).chain([32,40,63]){{if bit!=25{{assert!(!new(0x345^(1u64<