
    "Jjjg                   ^   d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlmZmZmZ ddlmZ  ee      j%                         j&                  d   Zed	z  Zed
z  ZdZdZdZdZdZdZ eed      Z eed      ZdZ dZ!dZ"dZ#dZ$g dZ% e&d      D  cg c]  } d|  	 c} Z'ddddge'Z(dZ)dZ*dDdZ+dEdZ,dFd Z-dGd!Z.dHd"Z/dId#Z0dJd$Z1dKd%Z2dLd&Z3dMd'Z4dNd(Z5dOd)Z6dPd*Z7dQd+Z8dRd,Z9	 	 dS	 	 	 	 	 	 	 dTd-Z:dUd.Z;dVd/Z<dWd0Z=e!e"f	 	 	 	 	 	 	 	 	 	 	 	 	 dXd1Z>dYd2Z?dZd3Z@d[d4ZAe#f	 	 	 	 	 	 	 d\d5ZBd]d6ZCd^d7ZDd_d8ZE	 	 	 	 	 	 	 	 	 	 d`d9ZFdad:ZGdbd;ZHdbd<ZIdcd=ZJddddddef	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddd>ZKded?ZLded@ZMedfdfdAZNdgdBZOePdCk(  r eO        yyc c} w )hzTSummarize the selector 10:0 follow-up seen in the patched selector 2:0 runtime poll.    )annotationsN)Path)Any)find_cns_stringsread_sectionsva_to_offset)trace_stream   outzHwanse2.exemap1_01amap2_02dz2:0z10:0
0x00540714
0x0053c4a4   
0x0059de30@      )activeOrderCountactiveOrder0activeOrder1activeOrder2activeSlot0DescriptoractiveSlot1DescriptoractiveSlot2DescriptorruntimeSlotBaseTable0runtimeSlotBaseTable1runtimeSlotBaseTable2runtimeObjectTable0runtimeObjectTable1runtimeObjectTable2opcode24Mode1Sourceopcode24RuntimeFlagopcode24CurrentObjectIndex   secondaryBranchStateactiveSelectionFlagr!   r"   r#   i  @ i  c                p    | j                         s|S t        j                  | j                  d            S )Nutf-8encoding)existsjsonloads	read_text)pathfallbacks     P/home/exedev/hwanse/tools/summarize_runtime_patched_selector_followup_context.py	load_jsonr2   A   s*    ;;=::dnngn677    c                    | D ]G  }|j                  d      xs g }|j                  d      |k(  s|j                  d      |k(  s||v sE|c S  i S )NselectorLabelsselectorprimarySelectorget)rowsr6   rowlabelss       r1   find_selectorr=   G   s\     )*0b77:(*cgg6G.HH.TX`djXjJ Ir3   c           	        d |j                  dd      D        \  }}g }| j                  d      xs i j                  d      xs g D ]  }|j                  d      |k(  s|j                  d      |k(  s-|j                  |j                  d      |j                  d      |j                  d      |j                  d	      |d
        |S )Nc              3  2   K   | ]  }t        |        y wN)int).0parts     r1   	<genexpr>z+find_selector_write_rows.<locals>.<genexpr>P   s     @3t9@s   :r
   opcode4fDataScanr:   groupslotvaHexmode)rI   rG   rH   rJ   r6   )splitr9   append)runtime_selector_byte_writesr6   rG   rH   r:   r;   s         r1   find_selector_write_rowsrN   O   s    @Q)?@KE4D,001CDJOOPVW][] 777u$D)@KK))$  Kr3   c                   i }| D ]  }|j                  d      xs i j                         D ]j  \  }}|j                  |i       }|xs g D ]J  }|j                  d      }||j                  |d      t        |j                  d      xs d      z   ||<   L l  t	        |j                               D 	ci c]8  \  }}|t	        |j                         d       D 	cg c]
  \  }}	||	d c}	}: c}	}}}S c c}	}w c c}	}}}w )NuniqueWatchValuesvalueHexr   countc                    | d    | d   fS )Nr
   r    )items    r1   <lambda>z2aggregate_watch_values_from_rows.<locals>.<lambda>k   s    RVWXRYQY[_`a[bPc r3   )key)rQ   rR   )r9   items
setdefaultrA   sorted)
r:   	aggregater;   namevaluestarget	value_row	value_hex
value_rowsrR   s
             r1    aggregate_watch_values_from_rowsrb   ^   s%   +-I ` WW%89?RFFH 	`LD&))$3F#\r `	%MM*5	$$*JJy!$<s9==QXCYC^]^?_$_y!	`	`` !'y'8 9 
 D*	 	$*:+;+;+=Cc$d
 	5 #U3
 	
 
s   8(D
 C;/D
;D
c                    | j                  |      xs g }t        |      dk7  ry |d   j                  d      |k7  ry |d   S )Nr
   r   rR   r9   len)watch_valuessample_countr\   r:   s       r1   single_watch_valuerh   q   sF    D!'RD
4yA~Aw{{7|+7Nr3   c                F    t        | ||      }|r|j                  d      S d S )NrQ   )rh   r9   )rf   rg   r\   r;   s       r1   watch_value_hexrj   z   s&    
\<
>C"%377:/4/r3   c                     t        | ||      d uS r@   )rh   )rf   rg   r\   s      r1   watch_value_stablerl      s    lL$?tKKr3   c                B    |D cg c]  }t        | ||       c}S c c}w r@   )rj   )rf   rg   namesr\   s       r1   stable_watch_hexesro      s    JOP$OL,=PPPs   c                    | r|sy t        | d      }t        |d      }||cxk  r|t        z   k  rn y dt        |z   |z
  dS y )Nr   0x08x)rA   
IMAGE_SIZE
IMAGE_BASE)r`   loaded_base_hexvalueloaded_bases       r1   runtime_to_static_hexrx      sV    O	2Eor*Ke6kJ66 J&4S9::r3   c                x   | xs i } | sdddS | j                  d      xs g }|D cg c]  }|j                  d      s| }}|xs |}t        d |D              t        |      t        |D ch c]%  }|j                  d      s|j                  d      ' c}      }t	        |      dk(  r|d	   nd }g d
}g d}g d}	g d}
t        |      }t        d      }|rt        |d      nd }||d | ng }t        |      }t        |	      }t        |
      }t        D ci c]+  }t        |      |t        |      t        |      d- }}i ddddd| j                  d      d| j                  d      dt	        |      dd|D cg c]%  }|j                  d      s|j                  d      ' c}dt        d	t	        |      t	        |      z
        d| j                  d      dt        | j                  d      xs i j                  d            d| j                  d      d | j                  d!      xs g d"| j                  d"      xs g d#| j                  d$      xs g d%| j                  d&      d'| j                  d(      d|||||||D cg c]  }t        ||       c}||D cg c]  }t        ||       c}||D cg c]  }t        ||       c}t        fd)t        D              |dd*g d+d,S c c}w c c}w c c}w c c}w c c}w c c}w c c}w )-NFKruntime_selected_pointer_patched_public_selector_2_0_active_order_poll.json	available
sourcePollr:   reachedRouteSelectorContextc              3  X   K   | ]"  }t        |j                  d       xs d       $ ywsampleCountr   NrA   r9   rB   r;   s     r1   rD   z6build_active_order_runtime_evidence.<locals>.<genexpr>   s#     N#S!7!<1=N   (*loadedBaseHexr
   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r    r   r   rQ   stabler|   Tr}   totalSequenceCountsequenceCounttotalSampleCountr   routeSequenceNamesr\   nonRouteSequenceCountpreludecaseAliasesEnabledcaseAliasesenabledstagedSaveKindstagedSelectorspublicSaveSelectorsobservedSelectorsobservedStagedSelectorsobservedPublicSaveSelectorsreachedCurrentRootanyReachedCurrentRootreachedRouteSelectoranyReachedRouteSelectorContextc              3  Z   K   | ]"  }j                  |      rt        |       $ y wr@   r9   rl   )rB   r\   route_sample_countrf   s     r1   rD   z6build_active_order_runtime_evidence.<locals>.<genexpr>   s1      &
% |-?F&
   (+diagnostic-only)zZactive order/count was observed only while loading the patched public-base diagnostic savezthe poll keeps activeOrderCount at 0x01 and the active order at descriptor id 0, matching the public-base save shape rather than a captured selector 2:0 route savezstable active-order bytes explain the diagnostic runtime state but do not prove normal gameplay executes selector 2:0 or reaches the map1_01a source trigger)activeOrderCountHexr   orderByteHexesactiveOrderHexesactiveSlotFirstDwordsHexactiveSlotFirstDwordsStaticHexruntimeSlotBaseTableHexesruntimeSlotBaseTableStaticHexesruntimeObjectTableHexesruntimeObjectTableStaticHexesallWatchedValuesStablewatchedValuesnotRoutePromotionProofpromotionStatusnonPromotingBecause)r9   sumrb   rZ   re   ro   rj   rA   ACTIVE_ORDER_WATCH_NAMESrl   maxboolrx   all)active_order_pollall_rowsr;   
route_rowsr:   loaded_basesru   order_byte_namesactive_slot_namesslot_base_table_namesobject_table_namesorder_byte_hexesactive_order_count_hexactive_order_countactive_order_hexesslot_first_dwordsslot_base_tableobject_tabler\   watched_valuesrv   r   rf   s                        @@r1   #build_active_order_runtime_evidencer      s   )/Rg
 	
 !$$V,2H!)T#SWW5R-S#TJT!DNNN3D9Lt`swwG_377?3`aL),\):a)?l1oTOGcg^),8JL\],\;MOab<R3R8X\BTB`)*=+=>fh*<9KM^_(7IK`aO%l4FHZ[L -
 <);TBN 	'6H$O(7I4P
 	
N /T/c/ 	/33OD/ 	-11-@	/
 	T/ 	)/ 	$R3#''&/swwvR/ 	 QHJ(G!H/ 	$((3/ 	d$5$9$9-$H$NB#S#ST]#^_/ 	+//0@A/ 	,001FGM2/ 	.223FGM2/ 	"#4#8#89V#W#][]/ 	/334KL/  	 1 5 56V W!/" 	#/$  6.*.$5GX+
>C!%9+
 &5GV,
>C!%9,
 $0GS*
>C!%9*
 #& &
0&
 #

 ("&, 
U/ /3 U a S +
,
*
s;   L L2L	L*0L#L(2L(.L-L2"L7c           
        | xs i } | sdddS | j                  d      xs g }|D cg c]  }|j                  d      s| }}t        | j                  d      xs d      | j                  d      xs t        |      t        d	 |D              }t        |      }t	        t
              }t	        ||t
              }t        |      t        t
              k(  xr t        d
 |D              }t        |      xr/ t        |      t        t
              k(  xr t        d |D              }	t        D 
ci c]+  }
t        |
      |
t        |
      t        |
      d- }}
t        D 
ci c]+  }
t        |||
      |
t        |||
      t        |||
      d- }}
i ddddd| j                  d      ddt        |      d|d|D cg c]%  }|j                  d      s|j                  d      ' c}dt        dt        |      t        |      z
        d| j                  d      dt        | j                  d      xs i j                  d            d| j                  d      d| j                  d      xs g d| j                  d      xs g d| j                  d      xs g d | j                  d!      d"| j                  d#      d$t        d%      i d&t        ||d%      d't        d(      d)t        d*      d+t        d,      d-|d.|d/|d0|	d1|rdnd d2|	rdnd d3t        fd4t        D              d5|d6|d7dd8d9d:g d;S c c}w c c}
w c c}
w c c}w )<NFKruntime_selected_pointer_patched_public_selector_2_0_branch_state_poll.jsonr{   r:   r~   r   r   observedWatchValuesc              3  X   K   | ]"  }t        |j                  d       xs d       $ ywr   r   r   s     r1   rD   z6build_branch_state_runtime_evidence.<locals>.<genexpr>   s#     T#S!7!<1=Tr   c              3  &   K   | ]	  }|d k(    yw0x00NrT   rB   rv   s     r1   rD   z6build_branch_state_runtime_evidence.<locals>.<genexpr>        CEC   c              3  &   K   | ]	  }|d k(    ywr   rT   r   s     r1   rD   z6build_branch_state_runtime_evidence.<locals>.<genexpr>  r   r   r   r|   Tr}   r   r   r   r   r\   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   activeSelectionFlagHexr&   routeActiveSelectionFlagHexopcode24Mode1SourceHexr!   opcode24RuntimeFlagHexr"   opcode24CurrentObjectIndexHexr#   secondaryBranchStateHexesrouteSecondaryBranchStateHexessecondaryBranchStateAllZero routeSecondaryBranchStateAllZero matchesPredecessorFillHypothesis%routeMatchesPredecessorFillHypothesisr   c              3  Z   K   | ]"  }j                  |      rt        |       $ y wr@   r   )rB   r\   total_sample_counttotal_watch_valuess     r1   rD   z6build_branch_state_runtime_evidence.<locals>.<genexpr>8  s2      &
!%%d+ 13EtL&
r   r   routeWatchedValuesr   r   r   r   )z\branch-state values were observed only while loading the patched public-base diagnostic savez`all secondary branch-state bytes stayed 0x00 across the constructed selector 2:0 diagnostic pollznan all-zero constructed diagnostic state does not prove normal gameplay executes the predecessor fill fragment)r9   rA   rb   r   ro   "SECONDARY_BRANCH_STATE_WATCH_NAMESre   r   r   BRANCH_STATE_WATCH_NAMESrj   rl   r   )branch_state_pollr   r;   r   r   route_watch_valuestotal_secondary_hexesroute_secondary_hexestotal_secondary_all_zeroroute_secondary_all_zeror\   r   route_watched_valuesr   r   s                @@r1   #build_branch_state_runtime_evidencer      s   )/Rg
 	
 !$$V,2H!)T#SWW5R-S#TJT.22=AFQG*../DEsIijrIsTTT9*E.*
 /* 	!"c*L&MM 	DC-BCC 
 	Z 	D%&#.P*QQ	DC-BCC  -
 -/A4HT 	'(:<NPTU();=OQUV
 	
N  -
 -/A4HT 	'(:<NPTU();=OQUV
 	
 2T2c2 	/33OD2 	.	2
 	Z2 	)2 	*X3PVswwvX2 	 QHJ(G!H2 	$((32 	d$5$9$9-$H$NB#S#ST]#^_2 	+//0@A2 	,001FGM22 	.223FGM22 	"#4#8#89V#W#][]2 	/334KL2  	 1 5 56V W!2" 	!/2DFXZo"p#2$ 	&!(
%2. 	!/2DFXZo"p/20 	!/2DFXZo"p122 	((*
32< 	$%:=2> 	)*??2@ 	&'?A2B 	+,DC2D 	+5MESWE2F 	0:RX\G2H 	!# &
0&
 #
I2R 	S2T 	2U2V 	!$W2X 	,Y2Z 	  
[2 2Q U0 Ys#   M% M%40M*.0M/M4'M4c                   | xs i } | sdddS | j                  d      xs g }|D cg c]$  }|j                  d      r|j                  d      & }}|D cg c]$  }|j                  d      r|j                  d      & }}|D cg c]$  }|j                  d      r|j                  d      & }}i d	d
ddd| j                  d      d| j                  d      d| j                  d      d| j                  d      xs g d|D cg c]  }|j                  d      |j                  d      xs i |j                  d      |j                  d      |j                  d      |j                  d      xs g |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      d c}dt        |      d|dt        |      d|dt        |      d|d| j                  d      d | j                  d       d!d
d"d#d$g d%iS c c}w c c}w c c}w c c}w )&NF2runtime_patched_selector_exit_candidates_poll.jsonr{   candidateRowsr   sideanyReachedStagedSelectorbranchStateNonzeror|   Tr}   
stagedKindbaseSavecandidateCountcandidateSaveRowstileautoTriggerr   selectorCountsr   opcode24Mode1SourceValuesopcode24RuntimeFlagValues opcode24CurrentObjectIndexValues)r   r   r   r   r   r   r   reachedStagedSelectorr   r   r   r   routeSelectorSideCountrouteSelectorSidesstagedSelectorSideCountstagedSelectorSidesbranchStateNonzeroSideCountbranchStateNonzeroSides anyCandidateReachedRouteSelectoranyCandidateBranchStateNonzeror   r   r   r   )zCcandidate saves are constructed from edited selector/position byteszWonly observed selector 2:0 hit is from a patched diagnostic save, not captured gameplayzRbranch-state and opcode24 watch values stay zero across candidate movement sampleszetop/bottom/right candidate sequences did not even observe the staged selector in this calibration runrd   )exit_candidate_pollr:   r;   route_sidesstaged_sidesbranch_nonzero_sidess         r1   %build_exit_candidate_runtime_evidencer  I  s   -3N
 	
 ""?39rD 7734 	K  77-. 	L  77'( 	 
(T(J( 	)--l;( 	'++J7	(
 	-112BC( 	0445HIOR( 	 
  -2"ww}5"ww}5"%''*:";%(WW-@%A%GR(+0P(Q),1K)L&)gg.B&C-0WW5P-Q-0WW5P-Q47GG<^4_
(0 	!#k"21(2 	k3(4 	"3|#45(6 	|7(8 	&s+?'@9(: 	"#7;(< 	+,?,C,CDf,g=(> 	)*=*A*ABb*c?(@ 	!$A(B 	,C(D 	  
E( (


s   )H;)I )ICI
c                d    | j                  |      xs g }dj                  d |D              xs dS )N,c              3     K   | ]:  }|j                  d       '|j                  d        d|j                  d        < yw)rQ   NxrR   r8   r   s     r1   rD   z%watch_value_counts.<locals>.<genexpr>  sF      77:* 77:
q!1 23s   A A-)r9   join)rf   r\   r:   s      r1   watch_value_countsr    s?    D!'RD88    
	r3   c                `    dj                  d | j                  d      xs g D              xs dS )Nr  c              3  f   K   | ])  }|j                  d        d|j                  d        + yw)r6   r	  rR   Nr8   rB   contexts     r1   rD   z*selector_context_counts.<locals>.<genexpr>  s7       ;;z"
#1W[[%9$:;s   /1uniqueSelectorContextsr
  )r  r9   r;   s    r1   selector_context_countsr    s9    88 ww78>B   
r3   c                   |xs i }|sd| dS |j                  d      xs g }|D cg c]6  }|j                  d      s!t        |j                  d      xs d      dkD  r|8 }}t        |      t        |j                  d      xs d      i dd	d
| d|j                  d      d|j                  d      d|j                  d      dt        |      d|D cg c]%  }|j                  d      s|j                  d      ' c}d|j                  d      xs g d|j                  d      xs g d|j                  d      d|j                  d      dt	        d |D              dt        d      dt        d      dt        d      dt        d       d!t        d"      t        d#      t        fd$d%D              d&S c c}w c c}w )'NFr{   r:   r~   routeSelectorHitCountr   r   r|   Tr}   r   r   r   routeSequenceCountr   r\   r   r   r   r   r   r   r   c              3  X   K   | ]"  }t        |j                  d       xs d       $ ywr  r   Nr   r   s     r1   rD   z1left_stability_recheck_summary.<locals>.<genexpr>  s%     $`TWS1H)I)NQ%O$`r   r   r!   r   r"   r   r#   activeOrderCountValuesr   activeSlot0DescriptorValuesr   r   c              3  `   K   | ]%  }j                  |      rt        |      d k(   ' ywr   r9   rj   rB   r\   rg   rf   s     r1   rD   z1left_stability_recheck_summary.<locals>.<genexpr>  s5      &
% L,=G&
   +.r!   r"   r#   )runtimeSlotBaseTable0ValuesallSamplesOpcode24Zero)r9   rA   rb   re   r   r  r   )source_pollpollr:   r;   r   rg   rf   s        @@r1   left_stability_recheck_summaryr$    sN   :2D%
 	
 88F!rD 7701SAX9Y9^]^5_bc5c 	J 
 4D9Ltxx.3!4LTk 	dhh/0 	/2	
 	txx. 	c*o 	*X3PVswwvX 	TXX&9:@b 	"488,I#J#Pb 	dhh'>? 	)I J 	 $`[_$`!` 	$%7F[%\ 	$%7F[%\ 	+,>|Mi,j  	!"4\CU"V!" 	&'9,H_'`#$ (:,H_'`"% &
d&
 #
'  Ys   ;GG4Gc                *   | xs i } | sdddS | j                  d      xs g }|D cg c]6  }|j                  d      s!t        |j                  d      xs d      dkD  r|8 }}|D cg c]	  }||vs| }}t        | j                  d      xs d      t        |      g d	}t        fd
|D              }t	        d|      }	t	        d|      }
t        d |D              }t        |	j                  d            }t        |
j                  d            }i ddddd| j                  d      d| j                  d      d| j                  d      dt        |      d|D cg c]%  }|j                  d      s|j                  d      ' c}dt        |      d|D cg c]%  }|j                  d      s|j                  d      ' c}d| j                  d      xs g d| j                  d      xs g d| j                  d      xs g d| j                  d      d | j                  d!      d|d"t        d#      d$t        d%      t        d&      ||D cg c]s  }|j                  d      |j                  d'      xs g |j                  d      t        |      |j                  d(      |j                  d      |j                  d      d)u c}|	|
|||r|s|sd*n|s|rd+nd,dd-g d.d/S c c}w c c}w c c}w c c}w c c}w )0NF1runtime_patched_selector_left_stability_poll.jsonr{   r:   r~   r  r   r   r  c              3  `   K   | ]%  }j                  |      rt        |      d k(   ' ywr   r  r  s     r1   rD   z8build_left_stability_runtime_evidence.<locals>.<genexpr>  s5      D! 	lD9VCr  9runtime_patched_selector_left_stability_recheck_poll.json4runtime_patched_selector_left_active_order_poll.jsonc              3  X   K   | ]"  }t        |j                  d       xs d       $ ywr  r   r   s     r1   rD   z8build_left_stability_runtime_evidence.<locals>.<genexpr>  s%     "^RU3sww/F'G'L1#M"^r   r|   Tr}   r   r   r   r  r   r\   r   nonRouteSequenceNamesr   r   r   r   r   r   r   r   r   r   r!   r   r"   r#   keyscurrentRootHitCount)r\   r,  r   r   r-  r  r   znot-reproduced
reproducedzno-route-hitr   )zIleft-exit stability poll uses a constructed public-base selector 2:0 savez6load-only and load-left variants stay at selector 50:0zYonly load-right observes selector 2:0/10:0, making the hit sequence-dependent calibrationz_selector-only and active-order rechecks did not reproduce the earlier left-load-right route hitz9opcode24 watch values stay 0x00 across the stability poll)r   opcode24AllZerosequenceRowsrecheckactiveOrderRecheckrouteHitReproducedByRecheck&routeHitReproducedWithActiveOrderWatchrouteHitReproducibilityr   r   r   )
r9   rA   rb   r   r$  r   r   re   r  r  )left_stability_pollleft_stability_recheck_pollleft_active_order_pollr:   r;   r   non_route_rowsopcode_watch_namesopcode24_all_zeror1  active_order_recheckoriginal_route_hit_countroute_hit_reproduced_by_recheck&route_hit_reproduced_with_active_orderrg   rf   s                 @@r1   %build_left_stability_runtime_evidencer@    s   
 .3M
 	
 ""6*0bD 7701SAX9Y9^]^5_bc5c 	J 
 &*CcS
-BcCNC*..}=BCL3D9L
  & 
 -C#G :>  #"^Y]"^^&*7;;7N+O&P#-12F2J2JKb2c-d*4T4I4 	)--.>?4 	,00A	4
 	*..}=4 	c*o4 	*X3PVswwvX4 	 ^!44 	 ^!_cswwW]#''&/!_4 	0445HIOR4 	.223HIOR4 	"#6#:#:;X#Y#_]_4 	1556MN4 	 3 7 78X Y4 	 !94  	$%7F[%\!4" 	$%7F[%\#4$ -?|Mi,j, 
  -2"ww}5"9#">'*ww/D'E),1H)I(+0M(N
 2'F2X (0OX~  /2X "&, 
[4 4;
 D> Y!_
s0   ;K<*	L4L(L?L&L=L&A8L
c                j    | rd| vry | j                  dd      \  }}t        |d      t        |d      fS )Nz..r
   r   )rK   rA   )rv   startends      r1   parse_hex_rangerD  %  s:    D%T1%JE3ub>3sB<''r3   c                V    | D ]$  }|d   }||d   z   }||cxk  r|k  sn |d   c S  y )Nvaraw_sizer\   rT   )sectionsrF  sectionrB  rC  s        r1   section_name_for_varJ  ,  sE     #gj))B6?"	#
 r3   c                v    t        ||      }||dz   t        |       kD  ry t        j                  d| |      d   S )N   z<Ir   )r   re   structunpack_from)exerH  rF  offsets       r1   read_u32rQ  5  s?    (B'F~!c#h.dC033r3   c           	     
   g }||z
  }||dz  z  }||z   }t        ||d      D ]^  }	t        | ||	      }
|
t        ||
      }d|	dd|
dd|
dz  d|	|z
  d|	|k(  ||d ud}|
|v r||
   |d<   |j                  |       ` |S )	NrL  rq   rr      02xz+#x)rI   rQ   lowOpcodeHexrelativeToPointerHexisSelectedPointerDwordpointerSection	isPointercns)rangerQ  rJ  rL   )rO  rH  strings	center_vabeforeafterr:   rB  rC  rF  rv   pointer_sectionr;   s                r1   dword_windowra  <  s     DE	UQYE
e
CE3" h+=-h>"S]U3K( c 23')I~c&:&(Io-(4
 G CJC!" Kr3   c                *   g }| D ]  }|j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      xs g |j                  d      |j                  d	      |j                  d
      |j                  d      |j                  d      d}|j                  |j                         D ci c]  \  }}|d g fvs|| c}}        |S c c}}w )NsteprI   rQ   	opcodeHexhandlerVaHexhandlerSectionfixedAdvances
pointerHexrZ  branchTargetHexfallthroughVaHex
stopReason)rc  rI   rQ   rd  re  rf  rg  rh  rZ  ri  rj  rk  )r9   rL   rX   )tracer:   r;   compactrW   rv   s         r1   compact_trace_rowsrn  \  s    D _GGFOWWW%
+-GGN3!gg&67 WW_5;'',/775>"ww'89 #(: ;'',/
 	'--/]JCUSWY[R\E\S%Z]^_  K ^s   .D=Dc                l    t        |       D ]&  }|j                  d      s|j                  d      c S  y )Nrk  )reversedr9   )rl  r;   s     r1   trace_stop_reasonrq  q  s5     )77< 77<(() r3   c                    |D ]d  }|j                  d      dk7  r|j                  d      }|s,t        |d      dz   }t        | ||      }| y d|dd|dt        ||      dc S  y )	Nrd  0x20rI   r   rL  rq   rr   )descriptorVaHexdescriptorPointerHexdescriptorPointerSection)r9   rA   rQ  rJ  )rO  rH  rl  r;   va_hexdescriptor_vadescriptor_values          r1   opcode20_descriptor_pointerrz  x  s     
77;6)!FB!+#C=A#!#M##67&()9#(>$?(;HFV(W
 	

 r3   c           
     t   g }| j                  d      xs i j                  d      xs g D ]  }|j                  d      }|st        |d      }||z
  |cxk  r	||z   k  s5n 8|j                  ||j                  d      |j                  d      |j                  d      |j                  d      d	        |S )
NaliasToCurrenthitssourceVaHexr   rQ   targetClasssourceLocationRolemetadataLike)r~  rQ   r  r  r  )r9   rA   rL   )followup_bridge
pointer_varadiusr}  hit
source_hex	source_vas          r1   find_nearby_current_bridge_hitsr    s    
 D $$%56<"AA&IOR WW]+

B'	)BzF/BBKK)GGJ/"ww}5&)gg.B&C # 7  Kr3   c                ,    t        fd| D              S )Nc              3  r   K   | ].  }|j                  d       k(  xs |j                  d      k(   0 yw)rQ   rh  Nr8   )rB   r;   r`   s     r1   rD   z'trace_contains_value.<locals>.<genexpr>  s6     gZ]swwz"i/U377<3HI3UUgs   47any)rl  r`   s    `r1   trace_contains_valuer    s    gafgggr3   c                    |sy|\  }}| D ]B  }|j                  d      xs |j                  d      }|s*|t        |d      cxk  r|k  s@ y D y)NFrQ   rh  r   T)r9   rA   )rl  value_rangerB  rC  r;   r`   s         r1   trace_contains_range_pointerr    s_    JE3 GGJ'@377<+@	#i"4:s: ; r3   c                ,    t        fd| D              S )Nc              3  L   K   | ]  }|j                  d       xs dv   yw)rZ   Nr8   )rB   r;   map_names     r1   rD   z,trace_contains_map_string.<locals>.<genexpr>  s#     CcxCGGEN0b1Cs   !$r  )rl  r  s    `r1   trace_contains_map_stringr    s    CUCCCr3   c                   | j                         s|D cg c]  }|dd|  d c}S | j                         }t        |      }t        ||      }t	        |j                  d      xs i j                  d            }t	        |j                  d            }	t	        |j                  d      xs i j                  d            }
g }|D ]9  t        d	      }t        ||||t              }t        |      }t        |||      xs i }t        ||      }t        fd
|D              }i ddddt        ||      dt        ||      dnd dt        dd|t        z
  ddt         ddt"        |z
  dd|j                  d      d|j                  d      xs i j                  d      dt%        |	xr |	d   |cxk  xr |	d   k  nc       dt%        |xr |d   |cxk  xr |d   k  nc       d|t        k(  d|r|d   j                  d      nd dt'        |      dkD  r|d   j                  d      nd d|j                  d       d!|j                  d"      d#|j                  d$      t)        |      |t+        |t,              t+        |t               t/        ||
      t1        |t2              t1        |t4              |t'        |      t%        |      |t7        ||||      d%g d&d'}|j9                  |       < |S c c}w )(NFzmissing executable )pointerVaHexcontextAvailableunavailableReasonaddressPredecessorRoottailRangeAfterLastFillHexaddressPredecessorRangeHexr|  targetRangeHexr   c              3  F   K   | ]  }|j                  d       k(    yw)r~  Nr8   )rB   r  pointer_hexs     r1   rD   z8build_exact_followup_pointer_contexts.<locals>.<genexpr>  s     csww}5Dcs   !r  r  TfileOffsetHexrq   06xrootHexrootOffsetHexrr   currentRootHexcurrentRootDeltaHexpredecessorRangeHexwithinAddressPredecessorRanger   r
   withinAddressPredecessorTailstartsAtAliasRootfirstOpcodeHexrd  secondOpcodeHexopcode20DescriptorVaHexrt  opcode20DescriptorPointerHexru   opcode20DescriptorPointerSectionrv  blocked)zthe sampled follow-up pointer lands inside the target-side address-predecessor tail, not at the 10:0 alias root or a map1_01a source recordzrthe exact selected dword is descriptor/script data and is not itself one of the nearby current-range bridge dwordszthe local stream trace stops before reaching a selected-pointer store, exact current-root reference, source map string, or target map stringzHthe pointer was observed only in the patched public-base diagnostic poll)traceStopReasonrl  "traceContainsSelectedPointerGlobal traceContainsCurrentRootExactRef$traceContainsCurrentRootRangePointertraceContainsSourceMapStringtraceContainsTargetMapString-exactSelectedPointerDwordIsCurrentRangeBridge"nearbyCurrentRangeBridgeDwordCount!hasNearbyCurrentRangeBridgeDwordsnearbyCurrentRangeBridgeDwordsdwordWindowr   r   )r+   
read_bytesr   r   rD  r9   rA   r	   FOLLOWUP_POINTER_TRACE_STEPSrn  rz  r  r  r   FOLLOWUP_ROOT_HEXFOLLOWUP_ROOT_VACURRENT_ROOT_HEXCURRENT_ROOT_VAr   re   rq  r  SELECTED_POINTER_GLOBAL_HEXr  r  SOURCETARGETra  rL   )exe_pathpointer_hexesaddress_predecessor_contextr  r  rO  rH  r\  
tail_rangepredecessor_rangecurrent_rangecontextsr  rl  compact_trace
descriptornearby_bridge_hitsexact_bridge_hitr  s       `              r1   %build_exact_followup_pointer_contextsr    s    ??  -
 	 !,$)':8*%E
 	
 


CS!HsH-G 	$	(	()A	B	HbMMNijJ ((C(G(GHd(ef#o&9&9:J&K&Qr%V%VWg%hjMH$ 3!b)
S(GZA]^*510hFL"
<_jYcPbcc+
K+
+
 Hj1=  ",x"DS!IJ+
 (+
 r*/?"?!DE+
 .+
 "R*(DS'I#J+
 "#>#B#BC_#`+
 (,001IJPbUUVqr+
 ,&d+<Q+?:+dPabcPd+de+
" +D1k
1Q[@k^hij^k@k,l#+
$  /?!?%+
& =mA.22;?VZ'+
( CDVYZDZ}Q/33K@`d)+
* &z~~6G'H++
, +JNN;Q,R-+
. /
?Y0Z/+
0  17"2FuNi2j0DUL\0]4PQVXe4f,EeV,T,EeV,T=M256H2I156H1I.@'Xw
K($K+
X 	 g3!h OK
s   Lc           
        | sy | j                  d      xs i }i }| j                  d      xs i j                         D ]+  \  }}|j                  d      |j                  d      d||<   - | j                  d      | j                  d      | j                  d      |j                  d	      | j                  d
      |j                  d      |j                  d      | j                  d      xs g |d	S )NselectorContextwatchValuesrQ   rv   )rQ   rv   sampleIndex	elapsedMsphaser6   selectedPointerStaticHexr  	offsetHexpressedKeyOffsets)	r  r  r  r6   r  r  r  r  r  )r9   rX   )eventr  rf   r\   rv   s        r1   event_summaryr    s    ii)*0bGL		-06B==? 
e		*-YYw'
T
 yy/YY{+7#KK
+$)II.H$I;;y)[[-"YY':;Ar#
 
r3   c                    g }d }| D ][  }|j                  d      xs i j                  d      }|t        t        hvr6||k(  r<t        |      }|r|j	                  |       |}] |S )Nr  r6   )r9   CURRENT_SELECTORFOLLOWUP_SELECTORr  rL   )eventstransitionslast_selectorr  r6   summarys         r1   selector_transition_summariesr    s    KM 	!II/06B;;JG,.?@@}$&w' 	! r3   c           	     Z   i }| D ]i  }|j                  d      xs i j                  d      }|t        t        hvr6t        |j                  d            |f}|j                  |d      dz   ||<   k t	        |j                               D cg c]  \  \  }}}|||d c}}}S c c}}}w )Nr  r6   r  r   r
   )r  r6   rR   )r9   r  r  strrZ   rX   )r  countsr  r6   rW   r  rR   s          r1   phase_selector_countsr  *  s    )+F -II/06B;;JG,.?@@599W%&1jja(1,s- )/v||~(>  %UHu	  	
  s   B&c                R   g }i }| j                  d      xs g D ]  }|j                  d      xs g }g }|j                  d      xs g D ]  }|j                  d      }|t        t        hvr#t        |j                  d      xs d      }|j                  |d      |z   ||<   |j	                  |||j                  d      |j                  d      xs g t
        |j                  d      xs g v t        |j                  d      xs g v d	        t        d
 |D        d       }	d }
|	rt        |	j                  d      xs d      }|D cg c]P  }|j                  d      xs i j                  d      t        k(  r#t        |j                  d      xs d      |k  r|R }}|r|d   }
|j	                  |j                  d      t        |      |j                  d      |j                  d      |t        |      t        |      t        |	      t        |
      d	        ||fS c c}w )Nr:   r  r  r6   rR   r   r  	fieldMaps)r6   rR   r  r  containsSourcecontainsTargetc              3  v   K   | ]1  }|j                  d       xs i j                  d      t        k(  r| 3 yw)r  r6   N)r9   r  )rB   r  s     r1   rD   z%poll_row_summaries.<locals>.<genexpr>Q  s;      II/06B;;JGK\\ s   79r  r  r\   r-  r  )	r\   
eventCountr-  r  r  selectorTransitionsphaseSelectorCountsfirstFollowupEventlastCurrentEventBeforeFollowup)r9   r  r  rA   rL   r  r  nextre   r  r  r  )r#  r:   totalsr;   r  r  r  r6   rR   first_followup_event"last_current_event_before_followupfirst_followup_indexr  current_events_before_followups                 r1   poll_row_summariesr  <  s=   DFxx%2 ."(bww78>B 	G{{:.H 02CDDG,12E%zz(A6>F8OO$";;y1$[[5;"(W[[-E-K"L"(W[[-E-K"L 	  $#
  
 .2*#&';'?'?'N'SRS#T  $.II/06B;;JGK[[		-05A69MM .* . .5STV5W2GGFOf+#&77+@#A%(WW-D%E #@#H#8#@"/0D"E.;<^._

 
	I.^ <'.s   
AH$c                R   t        |       \  }}t        d |D              }t        |D ch c]V  }|j                  d      xs g D ]<  }|j                  d      t        k(  r"|j                  d      r|j                  d      > X c}}      }|j                  d      xs i j                  d      xs g }t        |t              }t        |j                  d      xs g t              }t        |j                  d      xs g t              }t        |j                  d      xs g t              }t        |t              }|j                  d	      xs i }| j                  d
      xs g }| j                  d      xs g }| j                  d      xs g }|j                  d      xs |j                  d      xs g }|j                  d      xs i j                  d      |j                  d      xs i j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      d}t        ||||      } t        |      }!t        |      }"t        |	      }#t        |
||      }$|j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d       |j                  d!      d"}%g d#}&d$}'i d%t        d&t        d't        d(t        d)t        d*t         d+i d,| j                  d,      d-| j                  d-      d.| j                  d.      d/| j                  d/      d0t#        | j                  d1      xs i j                  d2            d3| j                  d3      d4|d
|d5|d6| j                  d7      d8| j                  d9      d:t        |v d;| j                  d;      d<|d=|d>|d?|d@t        |j                  dA      |j                  dB      |j                  dC      |j                  dD      xs g t#        |j                  dD            |t        |v t        |v |j                  dE      |j                  dF      |j                  dG      dHdI|j                  dJ      |j                  dK      |j                  dL      |j                  dM      |j                  dN      |j                  dE      |j                  dO      |j                  dP      |j                  dQ      |j                  dR      |j                  dS      |j                  dT      |j                  d;      dUdV|j                  dW      |j                  dX      |j                  dY      |j                  dZ      xs g d[d\|d]|%d^| d_|!d`|"da|#db|$|t%        |      |j                  dc      |j                  dd      xs i j                  de      |j                  df      dgt#        |      t        |v xr t        |v |dhkD  didj|&g dk|'dl	S c c}}w )mNc              3     K   | ]H  }|j                  d       xs g D cg c]  }|j                  d       c}dd t        t        gk(  rd J yc c}w w)r  r6   N   r
   )r9   r  r  )rB   r;   
transitions      r1   rD   z build_summary.<locals>.<genexpr>  s\       9<AV9W9][]^:JNN:&^_a`ab/01 	
  _s   AAAr  r6   r  targetAliasGroupaliases	aliasRowsselectorRootScansr  r   r   r   r  r|  hitCountdataHitCount&aliasToCurrentExecutionLikeBridgeFound#aliasToCurrentAfterLastFillHitCount'aliasToCurrentAfterLastFillDataHitCount,aliasToCurrentAfterLastFillPreWriterHitCount,aliasToCurrentAfterLastFillLeafTableHitCount5aliasToCurrentAfterLastFillTraceCurrentWriterHitCount5aliasToCurrentAfterLastFillTraceCurrentReaderHitCount8aliasToCurrentAfterLastFillTraceRouteSceneRecordHitCount3aliasToCurrentAfterLastFillExecutionLikeBridgeFound)aliasToCurrentHitCountaliasToCurrentDataHitCountr  r  r  r  r  r  r	  r
  r  opcode07SelectsCurrentRootCount opcode07SelectsCurrentRangeCount'opcode08NearestCurrentRootProducerCount(opcode08NearestCurrentRangeProducerCountopcode09StoresCurrentRootCountopcode09StoresCurrentRangeCountpromotingCandidateCount)r  r  r  r  r  r  r  )
zVpatched public-base diagnostic save is constructed from edited selector/position byteszZsampled 2:0 -> 10:0 selected-pointer movement comes from that constructed diagnostic statez:selector 10:0 contains the target map set but not map1_01az0selector 10:0 has no public captured save samplezcselector 10:0 has no non-current selected-pointer producer/store candidate for the current 2:0 rootz]target-alias bridge scans do not find an execution-like bridge into the current writer/readerzVpoll rows do not provide a normal gameplay control-flow trace or strict source hotspotzwpatched diagnostic branch-state watch keeps secondary branch state all-zero and cannot prove predecessor fill executionzxpatched exit-candidate movement poll is constructed diagnostic-only and keeps branch-state/opcode24 watch values at 0x00zpatched left-exit stability poll is constructed diagnostic-only; its initial 2:0 load-right hit did not reproduce in selector-only or active-order rechecksa  The patched public-base diagnostic poll proves that the original input-path/case-alias load path can select a constructed selector 2:0 save-shaped file. Its sampled events show the selected pointer starting at the current 2:0 root and later moving to a 10:0-range address in both candidate sequences. Selector 10:0 matches the target-side address-adjacent alias before the current root, contains map2_02d but not map1_01a, and its modeled fill/state and bridge evidence remain conditional. The branch-state diagnostic keeps secondary branch-state bytes at 0x00 even in the constructed selector 2:0 run, which is calibration evidence rather than predecessor-fill execution proof. The patched exit-candidate poll exercises top/bottom/left/right constructed selector 2:0 saves; only the left candidate observed selector 2:0, and all candidate samples kept branch-state and opcode24 watch values at 0x00. This is useful follow-up context, but it is not a captured gameplay save, normal-route selected-pointer trace, strict hotspot, or route promotion proof. The left stability poll initially separated load-only/load-left from load-right, but selector-only and active-order rechecks both stayed at selector 50:0. The earlier 2:0/10:0 hit is therefore non-reproducible constructed calibration, not route evidence. sourcer^   currentSelectorr  followupSelectorfollowupRootHexruntimePollr   r   startupWaitSecondsr   r   r   r   r   r   r   r   r   r   r   reachedFollowupSelectorr   runtimeSelectorSampleCountstransitionPairCount"followupSelectedPointerStaticHexesr:   followupAliasroler  rootAddressOrderIndexpublicSampleIds	fillCountfirstFillHexlastFillHex)r6   r   r  r!  r"  hasPublicSampler  r  r  r#  r$  r%  addressPredecessorEvidenceaddressPredecessorSelectoraddressPredecessorRootHexr   addressPredecessorContainsSource addressPredecessorContainsTarget4addressPredecessorLastFillAllStartsPassCurrentReader.addressPredecessorTailCurrentRootExactRefCount,addressPredecessorTailFrontierReaderRefCount*addressPredecessorTailSourceRecordRefCount*addressPredecessorTailTargetRecordRefCountexecutionOrderProven)r6   r  rangeHexr  r  r#  "lastFillAllStartsPassCurrentReadertailExactCurrentRootRefCounttailFrontierReaderRefCounttailSourceRecordRefCounttailTargetRecordRefCountr1  r   stateEffectstateEffectStatusallStartSlotsPassCurrentReaderpassingStartSlotCountuniqueFillValuesHex)r9  r:  r;  r<  bridgeEvidence!globalSelectedPointerPathEvidenceexactFollowupPointerContextsactiveOrderRuntimeEvidencebranchStateRuntimeEvidenceexitCandidateRuntimeEvidenceleftStabilityRuntimeEvidence$selectorByteWriteMechanismIdentifiedrF    crossWriteToCurrentSelectorCountselectorByteWritePromotesRoute)selectorWriteRowsselectorWriteRowCountrD  rE  rF  r   Tr  )zXcapture a gameplay savedat or equivalent runtime selected-pointer trace for selector 2:0zfprove a normal control-flow path from selector 10:0 or another predecessor into the current 2:0 readerzOfind a strict map1_01a source hotspot or equivalent original transition trigger)	selectorByteWriteEvidence"runtimeTransitionTimelineAvailable,coObservedCurrentAndFollowupInDiagnosticPoll+observedCurrentThenFollowupInDiagnosticPollr   r   notRoutePromotionReasonsremainingProofs
conclusion)r  r   rZ   r9   r  r=   rN   r  r   r   r  r@  r  r  r  r  r  r   re   )(r#  mapset_aliasesr  target_alias_state_effectstarget_alias_bridgesglobal_selected_pointer_pathsrM   r   r   r  r6  r7  r8  r  runtime_rowsruntime_selector_sample_countstransition_pair_countr;   r  &followup_selected_pointer_static_hexestarget_aliasesfollowup_aliasfollowup_stater  followup_global_pathfollowup_selector_write_rowsaddress_predecessor_rootobserved_selectorsstaged_selectorsobserved_staged_selectorsfollowup_field_mapsfollowup_bridge_countsexact_followup_pointer_contextsactive_order_runtime_evidencebranch_state_runtime_evidenceexit_candidate_runtime_evidenceleft_stability_runtime_evidenceglobal_path_countsnot_route_promotion_reasonsrO  s(                                           r1   build_summaryrj  q  s     4Fd3K0L0     .45''"78>B5 >>*%)::z~~Nh?i 	12525 .* %(();<BGG	RXVXN">3DEN"#=#A#A+#N#TRTVghN#$8$<$<[$I$ORQbcO(%))*=>D" $<<XZk#l :>>?WX^\^"56<"xx 56<" $)F G M2(,,[9h=Q=U=UVa=bhfh#2#6#67G#H#NB"S"ST^"_'6':':;K'L'RPR&W&WXf&g2A2E2EFn2o/>/B/BCh/i3B3F3FGp3q8G8K8KLz8{8G8K8KLz8{APATATCB
 BQATATCB
 ETDWDWFE
 @O?R?RA@
#* 'L.#	'# %HHY$Z!$GHY$Z!&KL_&`#&K#'# ,@+C+CDe+f,@,D,DEg,h3G3K3KLu3v4H4L4LMw4x*>*B*BCc*d+?+C+CDe+f#7#;#;<U#V#	8 _&_&_ 	+_ 	*	_
 	-_ 	,_ 	 
488M2
TXXo6
 !$((+?"@
 txx	*	

 !$(?(E2'J'J9'U"V
 dhh'78
 /
  !3
 &'@
 !$((+B"C
 #DHH-M$N
 &'8<N'N
 txx(9:
 *+I
 "#8
  12X!
" L#
_4 	)"&&v.%)))4%3%7%78O%P-112CDJ#N$6$67H$IJ,$(;;$(;;'++K8*..~>)--m<
5_P 	%3778TU2667RS3778TU9==>`a9==>`a155kB2M2Q2QF3 -H,K,KL|,}*E*I*IJx*y(C(G(GHt(u(C(G(GHt(u$?$C$CDZ$[:>>?PQ'
Q_r 	!/!3!34G!H.<.@.@Aa.b%3%7%78O%P#1#5#56K#L#RPR	
s_~ 	0_@ 	,-?A_B 	'(GC_D 	%&CE_F 	%&CG_H 	'(GI_J 	'(GK_N ">%()E%F4P4T4T65 2N1Q1QRd1e1kik0p0p21 /K.N.NOo.p
&
 /33H.I 22^7HL^7^7Lq7P"&$$?

 !}_ _w5s   AZ#
c                T   | d   }| d   }| d   }| d   }| d   }| d   }| d   }| d   }| d	   }	| d
   }
| d   }| d   }dd}ddd| d    d| d    dd| d    d| d    dd| d    d| d    dd|d    d|d    d d!j                  |d"         xs d# dd$|d%    dd!j                  |d&         xs d# dd'| d(    d)|d*    d+d!j                  |d,         xs d# dd-|
j                  d.       d/ ||
j                  d0             d1 ||
j                  d2             dd3|j                  d.       d4 ||j                  d5             d6 ||j                  d7             d8|j                  d9       d:|j                  d;       
d<| d=    d>| d?    dd| d@   ddAddBdCg}|dD   D ]j  }d!j                  dE |dF   D              xs d#}dGj                  dH |dI   D              xs d#}|j                  dJ|dK    dL|dM    dN|dO    dP| dQ| dR       l |j                  ddSddTdUdV|dW    dRdX|dY    dRdZ|d[    d|d\    dRd]d!j                  |d^         xs d# dRd_|d`    da|db    dc|dd    dRde|df    dRdg|dh    dRdi|dj    dk|dl    dmdn|do    dp|dq    drds|dt    dRdu|dv    d|dw    d|dx    dRdy|dz    dRd{|d|    dRdd}dd~dg       |D ]  }d|j                  d       d|j                  d       d|j                  d       d|j                  d       d|j                  d       
}|j                  dJ|d    dQ|j                  d       dQ|j                  d       dQ|j                  d       dQ|j                  d       d|j                  d       dQ|j                  d       dQ|j                  d       dQ|j                  d       dQ|j                  d       dQ| dR        |j                  g d       |D ]  }|j                  d|d    dddg       |j                  d      xs g D ]  }|j                  d|j                  d       dP|j                  d       dQ|j                  d       dQ|j                  d       dQ|j                  d       dL|j                  d      xs d# d        |j                  d        |j                  dddTdUd|j                  d       dRd|j                  d.       dRd|j                  d       d|j                  d       dd|j                  d       d|j                  d       dd ||j                  d5             dRd|j                  d       dRd ||j                  d"             dRd ||j                  d&             dRd|j                  d       d|j                  d       dRd|j                  d       dRd|j                  d       dRd ||j                  d             dRd ||j                  d             dRd ||j                  d             dRd ||j                  d             dRd ||j                  d«             dRd ||j                  dī             dRd ||j                  dƫ             dRd ||j                  dȫ             dRd|j                  dʫ       dRd|j                  d?       dRdg       |j                  dddTdUd|	j                  d       dRd|	j                  d.       dRd|	j                  d       d|	j                  d       dd|	j                  d       d|	j                  d       dd ||	j                  d5             dRd|	j                  d       dRd ||	j                  d"             dRd ||	j                  d&             dRd|	j                  d       d|	j                  d       dRd|	j                  dΫ       dRd|	j                  dЫ       dRd|	j                  dҫ       d|	j                  dӫ       d|	j                  dԫ       dRd ||	j                  d֫             dRd ||	j                  dث             dRd|	j                  dګ       dRd|	j                  dܫ       dRd|	j                  dޫ       dRd|	j                  dʫ       dRd|	j                  d?       dRdg       |j                  g dߢ       |
j                  d      xs g D ]  }|j                  d      xs i }|j                  d|j                  d       dP|j                  d       d|j                  d       dL|j                  d       dP|j                  d      xs d# dL|j                  d       dN|j                  d       dP|j                  d       dQ|j                  d       dQ|j                  d       dR        |j                  d       |j                  g d       |j                  d      xs g D ]  }|j                  dJ|j                  dK       dQ ||j                  d             dL|j                  d       dP|j                  d      xs d# dL|j                  dO       dP|j                  d       dQ|j                  d       dQ|j                  d       dR        |j                  d       d|j                  d      xs i fd|j                  d      xs i ffD ]  \  }}|j                  d| ddddJ|j                  d      xs d# dL|j                  d       dP ||j                  d"             dQ ||j                  d5             dL|j                  dO       dP|j                  d      xs d# dQ|j                  d      xs d# dQ|j                  d      xs d# dL|j                  d       ddg        |j                  ddg       |j                  d | d   D               |j                  g d       |j                  d | d   D               |j                  d       dj                  |      S (   Nr  r  r'  r8  r=  r>  r?  r@  rA  rB  rC  rI  c                B    dj                  d | xs g D              xs dS )N, c              3  8   K   | ]  }|t        |        y wr@   r  r   s     r1   rD   z0markdown.<locals>.join_values.<locals>.<genexpr>T       SARUS   r
  r  r]   s    r1   join_valueszmarkdown.<locals>.join_valuesS  !    yyS2SSZWZZr3   z,# Runtime Patched Selector Follow-up Contextr  z
- route: `r  z` -> `r^   `z- current selector/root: `r  z` / `r  z- follow-up selector/root: `r  r  z- runtime poll: r    sequence(s), r   z sample(s), observed `rm  r   r
  z- staged kind/selectors: `r   r   z8- co-observed current and follow-up in diagnostic poll: rK  z0- sampled current -> follow-up transition rows: r  z"- follow-up selected pointer(s): `r  z'- exit-candidate diagnostic: available=r|   z routeSides=`r   z` branchNonzeroSides=`r   z'- left-stability diagnostic: available=z routeSequences=`r   z` nonRouteSequences=`r+  z` opcode24AllZero=r/  z reproducibility=r5  z)- runtime transition timeline available: rJ  z- promotion status: `r   rO  z## Runtime RowszR| sequence | current hits | route hits | selector contexts | sampled transitions |z!| --- | ---: | ---: | --- | --- |r:   c              3  B   K   | ]  }|d     d|d    d|d      ywr6   rE   rR   @r  NrT   r  s     r1   rD   zmarkdown.<locals>.<genexpr>t  s;      
 z"#1WW%5$6a	8J7KL
   r   -> c              3  D   K   | ]  }|d     d|d    d|d    d  ywr6   rz  r  rE   r  msNrT   rB   r  s     r1   rD   zmarkdown.<locals>.<genexpr>x  sA      "
 *%&a
3M(N'OqQ[\gQhPiikl"
    r  z| `r\   z` | r-  z | r  z | `z` | `z` |z## Follow-up Selector 10:0z| property | value |z| --- | --- |z
| role | `r   z| root order | `r!  z| contains source/target | `r  r  z| public samples | `r"  z| fills | `r#  z` from `r$  z` to `r%  z| address predecessor range | `r2  z*| address predecessor execution proven | `r1  z| modeled state effect | `r9  z`, pass starts `r;  z`/12 |z| alias->current hits | `r  z
` total, `r  z` data |z+| after-last-fill execution-like bridge | `r  z;| after-last-fill trace writer/reader/scene-record hits | `r  r	  r
  z+| selected-pointer promoting candidates | `r  z| selector byte write rows | `rH  z"## Exact Follow-up Pointer Contextz| pointer | root offset | tail | root start | opcodes | opcode20 descriptor | trace stop | exact bridge | nearby bridge dwords | trace refs |z?| --- | ---: | --- | --- | --- | --- | --- | --- | ---: | --- |zselectedGlobal=r  , currentRoot=r  , currentRange=r  , sourceMap=r  , targetMap=r  r  r  r  r  r  r  r  r  r  r  r  )r  z### Exact Pointer Tracer  z#### z/| step | va | value | opcode | handler | stop |z&| ---: | --- | --- | --- | --- | --- |rl  z| rc  rI   rQ   rd  re  rk  z |z## Runtime Active Order Watchz| source poll | `r}   z| available | `z| route samples | `z
` across `z` route-reaching sequence(s) |z| total samples | `r   r   z` sequence(s) |z| route sequence names | `z| non-route sequences | `r   z| observed selectors | `z| staged selectors | `z| reached current/route | `r   r   z| loaded base | `r   z| active order count | `r   z| active order bytes | `r   z| active order used bytes | `r   z| active slot first dwords | `r   z%| active slot first dwords static | `r   z| runtime slot-base table | `r   z$| runtime slot-base table static | `r   z| runtime object table | `r   z!| runtime object table static | `r   z| all watched values stable | `r   z| promotion status | `z## Runtime Branch State Watchz| active selection flag | `r   z!| route active selection flag | `r   z"| opcode24 mode/runtime/object | `r   r   r   z| secondary branch state | `r   z"| route secondary branch state | `r   z%| secondary branch state all zero | `r   z+| route secondary branch state all zero | `r   z)| matches predecessor fill hypothesis | `r   )z## Exit-candidate Diagnosticr  zh| side | tile | samples | selectors | route 2:0 | branch nonzero | mode1 | runtime flag | object index |z8| --- | --- | ---: | --- | --- | --- | --- | --- | --- |r   r   r   r	  yr   r   r   r   r   )z## Left-stability Diagnosticr  z\| sequence | keys | samples | selectors | route hits | mode1 | runtime flag | object index |z3| --- | --- | ---: | --- | ---: | --- | --- | --- |r0  r,  selector-only recheckr1  active-order recheckr2  z### z| source poll | samples | selectors | route sequences | route hits | active order count | slot0 descriptor | runtime slot-base table0 | opcode24 all zero |z9| --- | ---: | --- | --- | ---: | --- | --- | --- | --- |r  r  r   r!  z## Non-promotion Reasonsc              3  &   K   | ]	  }d |   ywz- NrT   rB   reasons     r1   rD   zmarkdown.<locals>.<genexpr>*  s     Q62fXQr   rM  )r  z## Remaining Proofsr  c              3  &   K   | ]	  }d |   ywr  rT   rB   proofs     r1   rD   zmarkdown.<locals>.<genexpr>,  s     F%2eWFr   rN  
r]   zlist | Nonereturnr  )r  r9   rL   extend)r  runtimealiasaddressstatebridgeglobal_pathsexact_contextsactive_orderbranch_stateexit_candidatesleft_stabilityselector_writesrt  linesr;   r  r  r  
trace_refsrl  r   labelr1  s                           r1   markdownr  E  s   m$GO$E23GM"E%&F>?L;<N78L78L<=O;<N9:O[ 	7

WX&'vgh.?-@B
$W->%?$@gN^F_E``ab
&w/A'B&C5QbIcHddef
7?34N7=CYBZ [YYw':;<CDA	G
$W-=%>$?uTYYwWhOiEjEqnqDrrst
B7KyCzB{|
:7CX;Y:Z[
,TYYw?c7d-e-lil,mmno
1/2E2Ek2R1S T"?#6#67K#LMN O*?+>+>?X+YZ[[\	^ 2.2D2D[2Q1R S&~'9'9:N'OPQ R).*<*<=T*UVW X)--.?@A B)--.GHI		K
 4G<`4a3bc
(9 :;1=


\+9E< v 
99 
z?
 
   	 kk "
!"78"
 
   	 	#f+d3'<#=">c#F]B^A_ `z{m30	

 
LL
$

U6]O3'
5!89:#>
&u-='>&?uUK[E\D]]`a
tyy/@)ABIcJ#N
eK()%2G1HuUbOcNddgh
)'**=)>cB
4W=S5T4UUXY
$U+>%?$@@PQVWnQoPppvw
#F+C$D#EZPVWsPtOuu}~
5f=r6s5ttwxJKL MJKL MMNOs	T 6lC\6]5^^ab
(9P)Q(RRUV
,
 	XI5 8 " 
gkk*NOP Q";;'IJK L#KK(NOP Q %CDE F %CDE	G 	 	'.)*%O0L/M N:;<E'++NaBbAc d,-.a<M0N/O P:;<E'++N_B`Aa bKLM N@AB%
|SVX	

  
LL  
 " GN+,-=4	
 	 [[)/R 	ELLUYYv&'tEIIg,>+?uUYYzEZD[ \IIk*+5>1J0K499\*1c2"6	 	R 
LL'

L,,\:;3?
,**;78<
l..}=>jIYIYZiIjHk  lJ  	K
l../ABC:lN^N^_sNtMu  vE  	F
$[1A1ABV1W%X$YY\]
#L$4$45L$M#NcR
";|/?/?@S/T#U"VVYZ
 \-=-=>O-P!Q RRUV
%l&6&67K&L%MUS_ScScdzS{R||  	A
L,,_=>cB
"<#3#34I#J"K3O
";|/?/?@P/Q#R"SSVW
'L4D4DEW4X(Y'ZZ]^
(\5E5EF`5a)b(ccfg
/L<L<LMm<n0o/ppst
'L4D4DE`4a(b'ccfg
.{<;K;KLm;n/o.ppst
$[1A1AB[1\%]$^^ab
+K8H8HIh8i,j+kkno
),*:*:;S*T)UUXY
 !1!12C!D ESI
5 8 
LL'

L,,\:;3?
,**;78<
l..}=>jIYIYZiIjHk  lJ  	K
l../ABC:lN^N^_sNtMu  vE  	F
$[1A1ABV1W%X$YY\]
#L$4$45L$M#NcR
";|/?/?@S/T#U"VVYZ
 \-=-=>O-P!Q RRUV
%l&6&67K&L%MUS_ScScdzS{R||  	A
%l&6&67O&P%QQTU
+L,<,<=Z,[+\\_`
,\-=-=>V-W,XX]^j^n^n  pH  _I  ^J  JO  P\  P`  P`  a@  PA  OB  BE  	F
&{<3C3CD_3`'a&bbef
,[9I9IJj9k-l,mmpq
/0@0@A^0_/``cd
5l6F6FGi6j5kkno
3L4D4DEg4h3iilm
),*:*:;S*T)UUXY
 !1!12C!D ESI
1 4 
LL   ""?39r 
wwv$"!dhhsm_Adhhsm_DQ^I_H` a()0S1cgg>T6U5VVYww+,-T#'':U2V1W X345U377Ce;f:ggjl	

 
LL	LL   !!.17R 
#''&/"%CGGFO(D'ET#''R_J`Ia b()0S1cgg>U6V5W X""#>?@ A""#>?@ A""#EFGs	L	

 
LL	 ."4"4Y"?"E2F	!3!34H!I!ORP w 	5'N jG'++l+2s34M8R7S TGKK(;<=> ?GKK(<=>?t{{234 545<= >9:AcB C9:AcB${{345R9 
 		& 
LL"
  
LLQW5O-PQQ	LL01	LLF73D+EFF	LL99Ur3   c                Z"   | d   }| d   }| d   }| d   }| d   }| d   }| d   }| d   }| d	   }	| d
   }
| d   | d   }dddddddj                  fd|d   D              }dj                  d |D              }g }|D ]d  }dj                  d |j                  d      xs g D              }|j                  dt        j                  t        |d                d| d       f dj                  dt        j                  t        |j                  d                   ddt        j                  t        |j                  d                   ddt        j                  t        |j                  d                    d!t        j                  t        |j                  d"                   d#d$t        j                  t        |j                  d%                   d!t        j                  t        |j                  d&                   d'd(t        j                   |j                  d)                   dd*t        j                  t        |j                  d+                   dd,t        j                   |j                  d-                   dd.t        j                   |j                  d/                   dd0t        j                  t        |j                  d1                   d2t        j                  t        |j                  d3                   dd4t        j                  t        |j                  d5                   dd6t        j                  t        |j                  d7                   dd8t        j                   |j                  d9                   dd:t        j                   |j                  d;                   dd<t        j                   |j                  d=                   dd>t        j                   |j                  d?                   dd@t        j                   |j                  dA                   ddBt        j                   |j                  dC                   ddDt        j                   |j                  dE                   ddFt        j                   |j                  dG                   ddHt        j                  t        |j                  dI                   ddJt        j                  t        |j                  dK                   dg      }dj                  dt        j                  t        |	j                  d                   ddt        j                  t        |	j                  d                   ddt        j                  t        |	j                  d                    d!t        j                  t        |	j                  d"                   d#d$t        j                  t        |	j                  d%                   d!t        j                  t        |	j                  d&                   d'd(t        j                   |	j                  d)                   dd*t        j                  t        |	j                  d+                   dd,t        j                   |	j                  d-                   dd.t        j                   |	j                  d/                   dd0t        j                  t        |	j                  d1                   d2t        j                  t        |	j                  d3                   ddLt        j                  t        |	j                  dM                   ddNt        j                  t        |	j                  dO                   ddPt        j                  t        |	j                  dQ                   d2t        j                  t        |	j                  dR                   d2t        j                  t        |	j                  dS                   ddTt        j                   |	j                  dU                   ddVt        j                   |	j                  dW                   ddXt        j                  t        |	j                  dY                   ddZt        j                  t        |	j                  d[                   dd\t        j                  t        |	j                  d]                   ddHt        j                  t        |	j                  dI                   ddJt        j                  t        |	j                  dK                   dg      }dj                  d^ |
j                  d_      xs g D              }dj                  fd`j                  da      xs g D              }dj                  fdbdcj                  dd      xs i fdej                  df      xs i ffD              }dgj                  dh | di   D              }dgj                  dj | dk   D              }dj                  g dldmdndodpt        j                  | dq          drt        j                  | ds          dtdut        j                  | dv          d2t        j                  | dw          dtdxt        j                  | dy          d2t        j                  | dz          dtd{t        j                  t        |d"                d|t        j                  t        |d                 d}t        j                  d~j                  |d-         xs d       dtdt        j                  t        |d                d2t        j                  d~j                  |d/         xs d       dtd| d    ddt        j                  t        |d                ddt        j                  d~j                  |d         xs d       dtdt        j                  t        |
j                  d                   dt        j                   |
j                  d                   dt        j                   |
j                  d                   dtdt        j                  t        j                  d                   dt        j                   j                  d)                   dt        j                   j                  d                   dt        j                  t        j                  d                   dt        j                  t        j                  d                   dtd| d    ddt        j                  | dK          dtddt        j                  | d          ddd|ddddt        j                  t        |d                ddt        j                  t        |d                dd|d    d2|d    ddt        j                  d~j                  |d         xs d       ddt        j                  t        |d                dt        j                  t        |d                dt        j                  t        |d                ddt        j                  t        |d                ddt        j                  t        |d                ddt        j                  t        |d                dt        j                  t        |d                ddt        j                  t        |d                dt        j                  t        |d                ddt        j                  t        |d                ddt        j                  t        |d                d2t        j                  t        |d                d2t        j                  t        |d                ddt        j                  t        |d                ddt        j                  t        |d                dddȑdɑ|ddʑdj                  |      dˑd|dd̑d|dd͑dΑ|ddϑdБ|ddёdґ|ddӑdo| ddԑdo| d      S )Nr  r  r'  r8  r=  r>  r?  r@  rA  rB  rC  rI  c                B    dj                  d | xs g D              xs dS )Nrm  c              3  8   K   | ]  }|t        |        y wr@   ro  r   s     r1   rD   z1html_page.<locals>.join_values.<locals>.<genexpr>@  rp  rq  r
  rr  rs  s    r1   rt  zhtml_page.<locals>.join_values?  ru  r3   c                @    dj                  d | d   D              xs dS )Nrm  c              3  B   K   | ]  }|d     d|d    d|d      ywry  rT   r  s     r1   rD   z2html_page.<locals>.context_text.<locals>.<genexpr>C  s;      
 z"#1WW%5$6a	8J7KL
r{  r  r
  rr  r  s    r1   context_textzhtml_page.<locals>.context_textB  s.    yy 
z?
 
  	r3   c                @    dj                  d | d   D              xs dS )Nr|  c              3  D   K   | ]  }|d     d|d    d|d    d  ywr~  rT   r  s     r1   rD   z5html_page.<locals>.transition_text.<locals>.<genexpr>I  sA      
 *%&a
3M(N'OqQ[\gQhPiikl
r  r  r
  rr  r  s    r1   transition_textz"html_page.<locals>.transition_textH  s0    {{ 
!"78
 
  	r3   r  c              3  `  K   | ]  }d t        j                  t        |d                dt        j                  t        |d                dt        j                  t        |d                dt        j                   |             dt        j                   |             d  y	w)
<tr><td><code>r\   </code></td><td>r-  	</td><td>r  </td><td><code></code></td><td><code></code></td></tr>N)htmlescaper  )rB   r;   r  r  s     r1   rD   zhtml_page.<locals>.<genexpr>N  s      	 	[[S[!123 4{{3s#89:;< ={{3s#:;<=> ?[[c!234 5[[!567 8		s   B+B.r:   c              3    K   | ]  }d j                  g dt        j                  t        |d                dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d	                   dt        j                  t        |j	                  d
                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   dt        j                  t        |j	                  d                   d        yw)r  r  r  r  r  r  r  r  r  r  r  r  r  r  z%</code></td><td><code>selectedGlobal=r  r  r  r  r  r  r  r  r  r  N)r  r  r  r  r9   r  s     r1   rD   zhtml_page.<locals>.<genexpr>X  s     #( '	 	 	 	[[W^%<!=>?	@	[[W[[%A!BCD	E	 [[W[[1O%P!QRS	T	 [[W[[1D%E!FGH		I		
 [[W[[1A%B!CDE	
 FG	 ;;s7;;'89:;
<	=	 [[W[[1O%P!QRS	T	 [[W[[1B%C!DEF	G	 [[W[[1`%a!bcd	e	 [[W[[1U%V!WXY	Z	 ++c'++6Z*[&\]^	_	 {{3w{{3U'V#WXY	Z	 C4Z([$\]^	_	 [[W[[1O%P!QRS	T	  [[W[[1O%P!QRS!	"	#	 	#s   K#K%c              3  V  K   | ]   }d t        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d	      xs d
             d # yw)<tr><td>rc  r  rI   r  rQ   rd  re  r  rk  r
  
</td></tr>Nr  r  r  r9   )rB   rl  s     r1   rD   zhtml_page.<locals>.<genexpr>p  s      

 ;;s599V#4567 8S7);%<=> ?S:)>%?@A BS;)?%@AB CS>)B%CDE F;;s599\#:#AcBCD E

s   D'D)rl  z
<h3><code>r  z</code></h3><table><thead><tr><th>step</th><th>va</th><th>value</th><th>opcode</th><th>handler</th><th>stop</th></tr></thead><tbody>z</tbody></table>z"<tr><th>source poll</th><td><code>r}   r  z <tr><th>available</th><td><code>r|   z$<tr><th>route samples</th><td><code>r   z</code> across <code>r   z,</code> route-reaching sequence(s)</td></tr>z$<tr><th>total samples</th><td><code>r   r   z</code> sequence(s)</td></tr>z+<tr><th>route sequence names</th><td><code>r   z*<tr><th>non-route sequences</th><td><code>r   z)<tr><th>observed selectors</th><td><code>r   z'<tr><th>staged selectors</th><td><code>r   z,<tr><th>reached current/route</th><td><code>r   z</code> / <code>r   z"<tr><th>loaded base</th><td><code>r   z)<tr><th>active order count</th><td><code>r   z)<tr><th>active order bytes</th><td><code>r   z.<tr><th>active order used bytes</th><td><code>r   z/<tr><th>active slot first dwords</th><td><code>r   z6<tr><th>active slot first dwords static</th><td><code>r   z.<tr><th>runtime slot-base table</th><td><code>r   z5<tr><th>runtime slot-base table static</th><td><code>r   z+<tr><th>runtime object table</th><td><code>r   z2<tr><th>runtime object table static</th><td><code>r   z0<tr><th>all watched values stable</th><td><code>r   z'<tr><th>promotion status</th><td><code>r   z,<tr><th>active selection flag</th><td><code>r   z2<tr><th>route active selection flag</th><td><code>r   z3<tr><th>opcode24 mode/runtime/object</th><td><code>r   r   r   z-<tr><th>secondary branch state</th><td><code>r   z3<tr><th>route secondary branch state</th><td><code>r   z6<tr><th>secondary branch state all zero</th><td><code>r   z<<tr><th>route secondary branch state all zero</th><td><code>r   z:<tr><th>matches predecessor fill hypothesis</th><td><code>r   c              3    K   | ]  }d t        j                  t        |j                  d                   dt        j                  t        |j                  d      xs i j                  d            dz   t        |j                  d      xs i j                  d            z          dt        j                  t        |j                  d                   dt        j                  t        |j                  d	      xs d
             dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d                   d  yw)r  r   r  r   r	  r  r  r  r   r   r
  r   r  r   r   r  r   r   r  Nr  r   s     r1   rD   zhtml_page.<locals>.<genexpr>  s     $ 	{{3swwv/01 2[[cggfo&;%@%@%E!F!LsTWT[T[\bTcTigiSnSnorSsOt!tuv w{{3sww}5678 9[[SWW-=%>%E#!FGH I{{3sww'=>?@A B{{3sww';<=>? @[[SWW-H%I!JKL M[[SWW-H%I!JKL M[[SWW-O%P!QRS T
	$s   G5G7r   c              3  
  K   | ]y  }d t        j                  t        |j                  d                   dt        j                   |j                  d                   dt        j                  t        |j                  d                   dt        j                  t        |j                  d      xs d             dt        j                  t        |j                  d	                   dt        j                  t        j                  d
                   dt        j                  t        j                  d                   dt        j                  t        j                  d                   d | yw)r  r\   r  r,  r  r   r  r   r
  r  r   r   r   r  Nr  )rB   r;   rt  r  s     r1   rD   zhtml_page.<locals>.<genexpr>  sD     $ 	[[SWWV_!567 8[[SWWV_!=>? @{{3sww}5678 9[[SWW-=%>%E#!FGH I{{3sww'>?@AB C[[^%7%78S%T!UVW X[[^%7%78S%T!UVW X[[^%7%78Z%[!\]^ _		$s   F Fr0  c              3    K   | ]  \  }}d t        j                  |       dt        j                  t        |j                  d      xs d             dt        j                  t        |j                  d                   dt        j                   |j                  d                   dt        j                   |j                  d                   dt        j                  t        |j                  d	                   dt        j                  t        |j                  d
      xs d             dt        j                  t        |j                  d      xs d             dt        j                  t        |j                  d      xs d             dt        j                  t        |j                  d                   d  yw)r  r  r}   r
  r  r   r   r  r   r  r  r  r   r!  r  Nr  )rB   r  r1  rt  s      r1   rD   zhtml_page.<locals>.<genexpr>  s     , E7	{{5!" #[[W[[%>%E#!FGH I{{3w{{=9:;< =[[W[[9L-M!NOP Q[[W[[9M-N!OPQ R{{3w{{+BCDEF G[[W[[1I%J%Qc!RST U[[W[[1N%O%VSV!WXY Z[[W[[1N%O%VSV!WXY Z{{3w{{+CDEFG H	,s   GGr  r1  r  r2  r  c              3  N   K   | ]  }d t        j                  |       d  ywz<li></li>Nr  r  r  s     r1   rD   zhtml_page.<locals>.<genexpr>  s#     jFT[[017j   #%rM  c              3  N   K   | ]  }d t        j                  |       d  ywr  r  r  s     r1   rD   zhtml_page.<locals>.<genexpr>  s#     ^%tDKK./u5^r  rN  z^<!doctype html><meta charset="utf-8"><title>Runtime Patched Selector Follow-up Context</title>z<style>body{font-family:system-ui,sans-serif;background:#111;color:#eee;max-width:1120px;margin:24px auto}table{border-collapse:collapse;width:100%;margin:16px 0}td,th{border:1px solid #444;padding:6px 8px;vertical-align:top}code{color:#9bd4ff}</style>z3<h1>Runtime Patched Selector Follow-up Context</h1>z<ul>z<li>route: <code>r  z</code> -&gt; <code>r^   z</code></li>z!<li>current selector/root: <code>r  r  z#<li>follow-up selector/root: <code>r  r  z<li>runtime poll: rw  z sample(s), observed <code>rm  r
  z!<li>staged kind/selectors: <code>r   z:<li>co-observed current and follow-up in diagnostic poll: rK  r  z5<li>sampled current -&gt; follow-up transition rows: r  z)<li>follow-up selected pointer(s): <code>r  z)<li>exit-candidate diagnostic: available=z, routeSides=<code>r   z"</code>, branchNonzeroSides=<code>r   z)<li>left-stability diagnostic: available=z, routeSequences=<code>z!</code>, nonRouteSequences=<code>r+  z</code>, opcode24AllZero=<code>r/  z</code>, reproducibility=<code>r5  z+<li>runtime transition timeline available: rJ  z<li>promotion status: <code>z</ul>z<p>rO  z</p>z<h2>Runtime Rows</h2>z<table><thead><tr><th>sequence</th><th>current hits</th><th>route hits</th><th>selector contexts</th><th>sampled transitions</th></tr></thead><tbody>z <h2>Follow-up Selector 10:0</h2>z<table><tbody>z<tr><th>role</th><td><code>r   z!<tr><th>root order</th><td><code>r!  z-<tr><th>contains source/target</th><td><code>r  r  z%<tr><th>public samples</th><td><code>r"  z<tr><th>fills</th><td><code>r#  z</code> from <code>r$  z</code> to <code>r%  z0<tr><th>address predecessor range</th><td><code>r2  z;<tr><th>address predecessor execution proven</th><td><code>r1  z+<tr><th>modeled state effect</th><td><code>r9  z</code>, pass starts <code>r;  z</code>/12</td></tr>z-<tr><th>alias-&gt;current hits</th><td><code>r  z</code> total, <code>r  z</code> data</td></tr>z<<tr><th>after-last-fill execution-like bridge</th><td><code>r  zL<tr><th>after-last-fill trace writer/reader/scene-record hits</th><td><code>r  r	  r
  z<<tr><th>selected-pointer promoting candidates</th><td><code>r  z/<tr><th>selector byte write rows</th><td><code>rH  z(<h2>Exact Follow-up Pointer Context</h2>z<table><thead><tr><th>pointer</th><th>root offset</th><th>tail</th><th>root start</th><th>opcodes</th><th>opcode20 descriptor</th><th>trace stop</th><th>exact bridge</th><th>nearby bridge dwords</th><th>trace refs</th></tr></thead><tbody>z<h2>Exact Pointer Trace</h2>z#<h2>Runtime Active Order Watch</h2>z#<h2>Runtime Branch State Watch</h2>z"<h2>Exit-candidate Diagnostic</h2>z<table><thead><tr><th>side</th><th>tile</th><th>samples</th><th>selectors</th><th>route 2:0</th><th>branch nonzero</th><th>mode1</th><th>runtime flag</th><th>object index</th></tr></thead><tbody>z"<h2>Left-stability Diagnostic</h2>z<table><thead><tr><th>sequence</th><th>keys</th><th>samples</th><th>selectors</th><th>route hits</th><th>mode1</th><th>runtime flag</th><th>object index</th></tr></thead><tbody>z <h3>Left-stability Rechecks</h3>a  <table><thead><tr><th>kind</th><th>source poll</th><th>samples</th><th>selectors</th><th>route sequences</th><th>route hits</th><th>active order count</th><th>slot0 descriptor</th><th>runtime slot-base table0</th><th>opcode24 all zero</th></tr></thead><tbody>z<h2>Non-promotion Reasons</h2>z<h2>Remaining Proofs</h2>r  r;   dictr  r  )r  r9   rL   r  r  r  )r  r  r  r  r  r  r  r  r  r  r  r  rT  exact_context_rowsexact_trace_sectionsr  
trace_rowsactive_order_rowsbranch_state_rowsexit_candidate_rowsleft_stability_rowsleft_stability_recheck_rowsreasonsproofsr  rt  r  r  s                           @@@@r1   	html_pager  1  s   m$GO$E23GM"E%&F>?L;<N78L78L<=O;<N9:O[ 99 	 6?	 	L  #( &)# , ! 
YY 

 !W-3

 


 	##S)@%ABC DGl*,	

" 		0SAQAQR^A_=`1a0bbst.t{{3|?O?OP[?\;]/^.__pq24;;s<CSCSTaCb?c3d2eez{  |G  |G  HK  LX  L\  L\  ]l  Lm  Hn  |o  {p  p\  ]24;;s<CSCSTfCg?h3i2jj  AE  AL  AL  MP  Q]  Qa  Qa  bv  Qw  Mx  Ay  @z  zW  X9$++kR^RbRbcwRxFy:z9{  |M  N8SIYIYZqIrEs9t8u  vG  H7KP\P`P`atPuDv8w7x  yJ  K5dkk+lN^N^_pNqBr6s5t  uF  G:4;;s<K[K[\pKqGr;s:t  uE  FJ  FQ  FQ  RU  Vb  Vf  Vf  g}  V~  R  F@  EA  AR  S0SAQAQRaAb=c1d0eevw7CHXHXYnHoDp8q7r  sD  E7KP\P`P`aqPrDs8t7u  vG  H<T[[UaUeUefxUyIz={<|  }N  O=dkk+VbVfVf  hB  WC  KD  ?E  >F  FW  XDT[[Q\]i]m]m  oO  ^P  RQ  FR  ES  Sd  e<T[[UaUeUe  gB  VC  JD  >E  =F  FW  XCDKKP[\h\l\l  nO  ]P  QQ  ER  DS  Sd  e9$++kR^RbRbc|R}F~:  :A  AR  S@[YeYiYi  kJ  ZK  NL  BM  AN  N_  `>t{{3|O_O_`xOyKz?{>|  }N  O5dkk#lFVFVWhFiBj6k5ll}~+	
2 		0SAQAQR^A_=`1a0bbst.t{{3|?O?OP[?\;]/^.__pq24;;s<CSCSTaCb?c3d2eez{  |G  |G  HK  LX  L\  L\  ]l  Lm  Hn  |o  {p  p\  ]24;;s<CSCSTfCg?h3i2jj  AE  AL  AL  MP  Q]  Qa  Qa  bv  Qw  Mx  Ay  @z  zW  X9$++kR^RbRbcwRxFy:z9{  |M  N8SIYIYZqIrEs9t8u  vG  H7KP\P`P`atPuDv8w7x  yJ  K5dkk+lN^N^_pNqBr6s5t  uF  G:4;;s<K[K[\pKqGr;s:t  uE  FJ  FQ  FQ  RU  Vb  Vf  Vf  g}  V~  R  F@  EA  AR  S:4;;s<K[K[\tKuGv;w:x  yJ  K@SQ]QaQab  RA  NB  BC  AD  DU  VA$++cR^RbRbc{R|N}B~A  @P  QU  Q\  Q\  ]`  am  aq  aq  rJ  aK  ]L  QM  PN  N^  _c  _j  _j  kn  o{  o  o  @_  o`  ka  _b  ^c  ct  u;DKKT`TdTd  fA  UB  IC  =D  <E  EV  WA$++kZfZjZj  lL  [M  ON  CO  BP  Pa  bDT[[QTUaUeUe  gD  VE  RF  FG  EH  HY  ZJ4;;WZ[g[k[k  mO  \P  XQ  LR  KS  Sd  eHUXYeYiYi  kM  ZN  VO  JP  IQ  Qb  c>t{{3|O_O_`xOyKz?{>|  }N  O5dkk#lFVFVWhFiBj6k5ll}~'	
. )) $ #&&7=2$  )) $ "%%n5;$  #')) , %n&8&8&C&IrJ#^%7%78L%M%SQST
, #$ ggjgNhFijjGWW^7K\C]^^F99 EjE 	GE 	>E 		E
 DKK(9:;;OPTP[P[\cdl\mPnOoo{|E ,DKK@Q8R,S+TTdeiepepqx  zJ  rK  fL  eM  MY  	ZE .dkk'BT:U.V-WWghlhshst{  }N  uO  iP  hQ  Q]  	^E T[[W_-E)FGHW[WbWbcfgno|g}c~W  WA  A\  ]a  ]h  ]h  im  ir  ir  sz  {N  sO  iP  iW  TW  ]X  \Y  Ye  	fE ,DKKGDT<U8V,W+XXhimitituyu~u~  @G  HY  @Z  v[  vb  _b  jc  id  dp  	qE EWM{E|D}  ~C  	DE @CPWXmPnLo@p?qqvwE 4DKK		'RvJw@x@|  5A  4B  BN  	OE 4DKKODWDWXcDd@e4f3ggz{  |G  |G  HS  Tc  Tg  Tg  h|  T}  H~  |  {@  @b  cg  cn  cn  oz  {J  {N  {N  Oh  {i  oj  ck  bl  lx  	yE 4DKKNDVDVWbDc@d4e3ff}  C  J  J  KV  We  Wi  Wi  j~  W  K@  A  ~B  Bc  dh  do  do  p{  |J  |N  |N  Of  |g  ph  di  cj  jI  JN  JU  JU  VY  Zh  Zl  Zl  m~  Z  V@  JA  IB  Ba  bf  bm  bm  nq  r@  rD  rD  E^  r_  n`  ba  ab  bn  	oE 6g>b6c5ddijE  't{{7;L3M'N&O|\!E" 	#E$ dkk',/016%E& 	 'E( 	`)E* 	+E, 	-E. 	+/E0 	1E2 &dkk#eFm2D&E%FFWX3E4 ,DKKEBY<Z8[,\+]]no5E6 8>N8O7PP`afgwax`y  zK  	L7E8 0DIIeL]F^<_<fcf0g/hhyz9E: 't{{3u[7I3J'K&LL_`d`k`klopu  wE  qF  mG  aH  `I  IZ  [_  [f  [f  gj  kp  q~  k  g@  [A  ZB  BS  	T;E< ;4;;s7S]K^G_;`:aars=E> FdkkRUV]^tVuRvFwEx  yJ  	K?E@ 6dkk#eL_F`Ba6b5cc~  @D  @K  @K  LO  PU  Vm  Pn  Lo  @p  q  qE  	FAEB 8COgHhDi8j7k  lA  BF  BM  BM  NQ  RX  Yu  Rv  Nw  Bx  Ay  yO  	PCED Gt{{SVW]  _T  XU  TV  HW  GX  Xi  	jEEF WW[WbWbcfgm  of  hg  dh  Xi  Wj  jz  {  {F  {F  GJ  KQ  RI  KJ  GK  {L  zM  M]  ^b  ^i  ^i  jm  nt  uo  np  jq  ^r  ]s  sD  	EGEH Gt{{SVWcd}W~S  HA  GB  BS  	TIEJ :$++c/ZqJrFs:t9u  vG  	HKEL 	MEN 	3OEP 	yQER 	SET 	UEV 	'WEX 			&'YEZ 	.[E\ 	]E^ 	_E` 	aEb 	.cEd 	eEf 	gEh 	iEj 	-kEl 	NmEn 	oEp 	qEr 	-sEt 	|uEv 	wEx 	yEz 	+{E| 	N}E~ 	$E@ 	AEB 	)CED wiuEEF 	$GEH vheIE E Er3   c                   |j                  dd       |dz  }|j                  t        j                  | dd      dz   d	       |9|j                  j                  dd       |j                  t        |       d	       |S )
NT)parentsexist_okz.runtime_patched_selector_followup_context.jsonFr  )ensure_asciiindentr  r(   r)   )mkdir
write_textr,   dumpsparentr  )r  out_dirhtml_outjson_outs       r1   write_outputsr  '  s    MM$M.IIH

7q9D@   dT:Ig.AOr3   c                    t        j                  t              } | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  d	t        t
        d
z         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t
        dz         | j                  dt        t               | j                  dt        t
               | j                  dt        d d !       | j                         }t        t        |j                  i       t        |j                  i       t        |j                  i       t        |j                  i       t        |j                  i       t        |j                  i       t        |j                   i       t        |j"                  i       t        |j$                  i       t        |j&                  i       t        |j(                  i       t        |j*                  i       t        |j,                  i       |j.                        }t1        ||j2                  |j4                        }t7        d"|        y )#N)descriptionz--pollzTruntime_selected_pointer_patched_public_selector_2_0_input_path_case_alias_poll.json)typedefaultz--mapset-aliasesz!save_selector_mapset_aliases.jsonz--address-predecessor-contextz.save_selector_address_predecessor_context.jsonz--target-alias-state-effectsz-save_selector_target_alias_state_effects.jsonz--target-alias-bridgesz'save_selector_target_alias_bridges.jsonz--global-selected-pointer-pathsz0save_selector_global_selected_pointer_paths.jsonz--runtime-selector-byte-writesz/save_selector_runtime_selector_byte_writes.jsonz--active-order-pollrz   z--branch-state-pollr   z--exit-candidate-pollr   z--left-stability-pollr&  z--left-stability-recheck-pollr(  z--left-active-order-pollr)  z--exez	--out-dirz
--html-outzHOptional legacy HTML output path. JSON is the default retained artifact.)r  r  helpz4wrote runtime patched selector follow-up context -> )argparseArgumentParser__doc__add_argumentr   OUTEXE
parse_argsrj  r2   r#  rP  r  rQ  rR  rS  rM   r   r   r  r6  r7  r8  rO  r  r  r  print)parserargsr  r  s       r1   mainr  4  s6   $$9F
ll  
 *sEh?hi
'FF  
 &EE  
 0tSKtEtu
)HH  
 (GG  
 cc  
 cc  
 JJ  
 II  
 'QQ  
 "LL  
 dC8
$<
W	   D$))R $%%r*$22B7$1126$++R0$44b9$33R8$(("-$(("-$**B/$**B/$22B7$--r2G  WdllDMMBH	@

KLr3   __main__)r/   r   r0   r   r  r   )r:   
list[dict]r6   r  r  r  )rM   r  r6   r  r  r  )r:   r  r  zdict[str, list[dict[str, Any]]])rf   r  rg   rA   r\   r  r  dict | None)rf   r  rg   rA   r\   r  r  
str | None)rf   r  rg   rA   r\   r  r  r   )rf   r  rg   rA   rn   	list[str]r  zlist[str | None])r`   r  ru   r  r  r  )r   r  r  r  )r   r  r  r  )r  r  r  r  )rf   r  r\   r  r  r  r  )r"  r  r#  r  r  r  )NN)r6  r  r7  r  r8  r  r  r  )rv   r  r  tuple[int, int] | None)rH  r  rF  rA   r  r  )rO  bytesrH  r  rF  rA   r  z
int | None)rO  r  rH  r  r\  zdict[int, str]r]  rA   r^  rA   r_  rA   r  r  )rl  r  r  r  )rl  r  r  r  )rO  r  rH  r  rl  r  r  r  )r  r  r  rA   r  rA   r  r  )rl  r  r`   r  r  r   )rl  r  r  r  r  r   )rl  r  r  r  r  r   )
r  r   r  r  r  r  r  r  r  r  )r  r  r  r  )r  r  r  r  )r#  r  r  z!tuple[list[dict], dict[str, int]])r#  r  rP  r  r  r  rQ  r  rR  r  rS  r  rM   r  r   r  r   r  r  r  r6  r  r7  r  r8  r  r  r   r  r  )r  r  r  r  )r  r  r  r   r  zPath | Noner  r   )r  None)Qr  
__future__r   r  r  r,   rM  pathlibr   typingr   probe_exe_scene_tablesr   r   r   %summarize_save_selector_stream_tracesr	   __file__resolver  ROOTr  r  r  r  r  r  r  r  rA   r  r  r  FOLLOWUP_POINTER_WINDOW_BEFOREFOLLOWUP_POINTER_WINDOW_AFTERFOLLOWUP_POINTER_BRIDGE_RADIUSr  r   r[  r   r   rt   rs   r2   r=   rN   rb   rh   rj   rl   ro   rx   r   r   r  r  r  r$  r@  rD  rJ  rQ  ra  rn  rq  rz  r  r  r  r  r  r  r  r  r  rj  r  r  r  r  __name__)indexs   0r1   <module>r     s   Z "       P P > H~''*
Ul
]		     &+("- * !%  $ !% !  ( r& 5'"& "
  	
 (  

8&0
LQPfbJ?D'X 04*.]$]!,] (] 
	]@(4 1.	  	
   @*, 1  	,hDLLL "&L 	L
 L^. $2z &*%)'+'+/3*.Q
QQ "&Q !%	Q
 Q $(Q #'Q #Q #Q %Q %Q "-Q (Q Q 
QhiXsl 25d 
UMp zF u2&s   F*