
    UHjs                       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Zddlm	Z	 ddl
mZ ej                  j                  d e e	e      j!                         j"                               ddlmZmZmZmZ  e	e      j!                         j.                  d   Zedz  Zd	Zd
ZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&g dZ'g dZ(ddddddddddd dd!d"dgZ)d9d#Z*d9d$Z+d:d%Z,d;d&Z-d<d'Z.d=d(Z/d>d)Z0d?d*Z1d@d+Z2dAd,Z3dBd-Z4dCd.Z5dDd/Z6	 	 	 	 	 	 	 	 	 	 dEd0Z7	 	 	 	 	 	 	 	 	 	 dFd1Z8dGd2Z9	 	 	 	 dH	 	 	 	 	 	 	 	 	 	 	 dId3Z:dJd4Z;dJd5Z<efdKd6Z=dLd7Z>e?d8k(  r e>        yy)MzHSummarize runtime materializers for opcode 0x20 active descriptor order.    )annotationsN)Path)Any)find_cns_stringsoffset_to_varead_sectionsva_to_offset   outmap1_01amap2_02di D i8D iC i\!C i##C iA%C i4B i4B i4B )b   c   `   )z!current-selector-2-0-active-orderz,selected-root-runtime-materializer-executionz,normal-route-descriptor-mutation-observationzroute-promotion-proof)zIcurrent selector 2:0 active order/count from public or captured save datazNselected-root runtime execution through save-load rebuild or materializer pathzenormal-route observation tying materialized active descriptor order to opcode 0x20 descriptor scriptszProute-promotion proof linking active order/materializers to map1_01a -> map2_02dHwanse2.exez>active slot materializer routines and handler table references)pathdescriptionzout/save_loader_trace.jsonz/save-load block reads and rebuild-call orderingz2out/save_selector_opcode20_descriptor_scripts.jsonzIdescriptor script mutation scan and opcode 0x20 self-mutation eliminationz4out/save_selector_opcode20_sample_order_effects.jsonz'public sample active-order coverage gapz#out/save_selector_leaf_streams.jsonzKcurrent selector leaf low-byte rows decoded through the save-selector tablec                    d| dS )N0x08x values    S/home/exedev/hwanse/tools/summarize_save_selector_opcode20_runtime_materializers.pyhex32r   8       c{    c                    d| dS )Nr   02xr   r   s    r   hex8r    <   r   r   c                p    | j                         s|S t        j                  | j                  d            S )Nutf-8encoding)existsjsonloads	read_text)r   fallbacks     r   	load_jsonr*   @   s*    ;;=::dnngn677r   c                "    | rt        | d      S d S )N   )intr   s    r   	parse_hexr.   F   s    "3ub>,,r   c                v    t        ||      }||dz   t        |       kD  ry t        j                  d| |      d   S )N   z<Ir   )r	   lenstructunpack_from)exesectionsvaoffsets       r   dword_atr8   J   s?    (B'F~!c#h.dC033r   c                \    |y | D ]$  }|d   }||d   z   }||cxk  r|k  sn |d   c S  y )Nr6   raw_sizenamer   )r5   r6   sectionstartends        r   section_name_for_var?   Q   sM    	z #gj))B6?"	#
 r   c                R    t        d |D              }|d   | |d   |d   |d   z    fS )Nc              3  2   K   | ]  }|d    dk(  s|  yw)r;   z.textNr   ).0r<   s     r   	<genexpr>ztext_bytes.<locals>.<genexpr>]   s     NG76?g3MNs   r6   rawr:   )next)r4   r5   texts      r   
text_bytesrG   \   s:    NxNND:s4;etJ7G)GHHHr   c                    t        | |      \  }}g }t        dt        |      dz
        D ]a  }||   dk7  rt        j                  d||dz         d   }||z   }|dz   |z   }	|	|k(  s<|j                  t        |      t        |      d       c |S )Nr   r0      z<ir
      )	callVaHextargetVaHex)rG   ranger1   r2   r3   appendr   )
r4   r5   targettext_varD   rowsindexrelcall_varesolveds
             r   relative_call_refsrV   a   s    c8,LGSDq#c(Q,' 
u:  sEAI6q9E/Q;$vKK"7^$V} 
 Kr   c                    ||dz  z   }t        | ||      }|t        |      t        |      |t        |      nd t        ||      dS )Nr0   )opcode	opcodeHex
entryVaHexhandlerVaHexhandlerSection)r8   r    r   r?   )r4   r5   table_varX   entry_va
handler_vas         r   handler_table_rowr`   r   sR    &1*$H#x2J&\Ho-7-Cj)-h
C r   c                   dt        t              t        t              ddt        t              g ddddt        t              t        t              d d t        t              dd	gd
ddt        t              t        t              ddt        t              g dddg}|D ]A  }t        |j                  d            }|t        | ||      ng |d<   t        |d         |d<   C |S )Nzadd active save/object slot0x62
0x00407cc1)z#0x00432167 writes 0x004576e9[count]z#0x00432188 writes 0x0059db30[count]z 0x0043218f increments 0x004576e8z)0x004321cd writes slot descriptor pointerzSCalled by the general-table opcode 0x62 handler with stream+1 as the descriptor id.)r;   functionStartVaHexcoreLabelVaHexgeneralOpcodeHexgeneralHandlerVaHexdirectCallTargetVaHex
coreWritesmeaningzrebuild active slot descriptorsz#0x004323ba writes 0x0059db30[index]z)0x004323dd writes slot descriptor pointerzdCalled after save blocks are loaded to materialize descriptor pointers from saved count/order bytes.z&remove/rebuild active slot descriptors0x63
0x00407ce5)z*0x004326a3 compacts 0x004576e9 order bytesz)0x004326b6 compacts 0x0059db30 slot basesz 0x004326c2 decrements 0x004576e8z)0x0043271f writes slot descriptor pointerz]Called by the general-table opcode 0x63 handler with stream+1 as the descriptor id to remove.rh   relativeCallRefsrelativeCallRefCount)	r   ADD_ACTIVE_SLOT_FUNCTIONADD_ACTIVE_SLOT_CORE_LABELREBUILD_ACTIVE_SLOT_DESCRIPTORSREMOVE_ACTIVE_SLOT_FUNCTIONr.   getrV   r1   )r4   r5   rQ   rowrO   s        r   materializer_rowsru   ~   s    2"'(@"A#$>? &#/%*+C%D m	
  6"'(G"H#$CD $#'%*+J%K5; ~	
 ="'(C"D#$?@ &#/%*+F%G w	
;,DZ  C377#:;<OUOa"4S(F"Kgi&)#.@*A&B"#C Kr   c           
        | j                  d      xs g D cg c]  }t        |j                  d             }}|D cg c]  }||	 }}t        d |D        g       }|D cg c]  }t        |j                  d             }}|D cg c]  }||	 }}|rt        |      nd }|r|d   nd }|D cg c]  }t	        |       c}|t	        |      nd |t	        |      nd t	        t
              t	        t              t	        t              |d uxr |d uxr ||k  |d uxr |t        cxk  xr t        k  dd	S c dd	S c c}w c c}w c c}w c c}w c c}w )NsaveReadBlocksrK   c              3  r   K   | ]/  }|d    t        t              k(  s|j                  d      xs g  1 yw)rd   rm   N)r   rq   rs   rB   rt   s     r   rC   z(load_rebuild_evidence.<locals>.<genexpr>   sH       	LssK_G`di  kJ  eK  HK#	$	*	*  	Ls   77r   zThe save-load path reads the count/order and slot blocks, calls 0x00432323, then selects the save selector pointer from 0x004576da/0x004576db.)	saveReadCallVaHexeslastSaveReadCallVaHexrebuildCallVaHexrebuildFunctionVaHexselectorGroupLoadVaHexselectedPointerStoreVaHexrebuildAfterSaveReadBlocks%rebuildBeforeSelectorPointerSelectionrj   )rs   r.   rE   maxr   rq   SELECTOR_GROUP_LOADSELECTED_POINTER_STORE)	save_loader_tracematerializersrt   
read_callsr   rebuild_callsrebuild_call_valueslast_save_read_callrebuild_calls	            r   load_rebuild_evidencer      s    %(()9:@b 	#''+&'J  &0EE53D%EJE 	Lm  	L
M GTTs9SWW[%9:TT.AWUUEV5WW-7#j/T-@&q)dL:DEeE?R?^':!;dh3?3KE,/QU %&E F"'(;"<%*+A%B$ 3#4/3#l2 $ L2K5KKD#  LD#  F
 UW  Fs(   !EEE$!EEE5Ec                   t        t              t        t              t        D cg c]!  }i t	        | |t        |      d|dk(  rdndi# c}t        D cg c]  }i t	        | |t        |      ddi c}dS c c}w c c}w )NmutationRoler   zadd active slotzremove active slotz;not an active-order materializer in the save-selector table)generalHandlerTableVaHexsaveSelectorHandlerTableVaHexgeneralMutationHandlerssaveSelectorSameLowByteHandlers)r   GENERAL_HANDLER_TABLESAVE_SELECTOR_HANDLER_TABLEACTIVE_MUTATION_OPCODESr`   )r4   r5   rX   s      r   handler_rowsr      s    $)*?$@)./J)K 2$

 	#C3H&QVt^ 1I]$
 2,

 	#C3NPVW ],
 $
,
s   &A9A>
c                p    | j                  d      s||v ry| j                  d      du st        ||      yy)NcnspointerTscalar)rs   r	   )wordstringsr5   r   s       r   
value_kindr      s:    xx%7*xx	d"l8U&C&Or   c                x   g }|D ]1  }dD ](  \  }}}|j                  |      }	|	s|j                  |      xs g D ]  }
t        |
j                  d            }|
j                  d      }||3|dz  }|t        vrAt        | |t        |      }t        | |t
        |      }|j                  ||	|
j                  d      ||
j                  d      t        |      t        |
|||      |
j                  d      xs |j                  |      |j                  d      |j                  d      dd	d
        + 4 |S )N))leafwordsleafPointerHex)nestednestedWordsnestedPointerHexvalueHexvaHex   rR   r   r[   Fzocurrent route leaf/nested rows are decoded through the save-selector table, not the general nested-object table)
streamKindstreamVaHex	wordIndex	wordVaHexr   
lowByteHex	valueKindr   saveSelectorHandlerVaHexrg   isGeneralMutationInThisStreamreason)	rs   r.   r   r`   r   r   rN   r    r   )r4   r5   r   leaf_streamsrQ   streamstream_kind	words_keystream_va_key	stream_var   r   word_varX   save_handlergeneral_handlers                   r   current_route_low_byte_rowsr      sV    D 6
 	1KM 

=1I

9-3 !$((:"67((7+=GO!880h@[]cd"3CCXZ`"a"-#,!%'!2!( $ 4"&v,!+D'8U!K88E?@gkk%.@0<0@0@0P+:+>+>~+N5: P 	@ Kr   c                   g }|j                  d      xs g D ]  }dD ]  \  }}t        |j                  |            }|#t        t              D ]  }	||	dz  z   }
t	        | ||
      }| N|dz  }|t
        vr*|j                  |j                  d      |t        |      |	t        |
      t        |      t        |      ||v rdnt        ||      dnd|j                  |      d		          |S )
NdescriptorRows))script0VaHexzscript+0)script4VaHexzscript+4)script8VaHexzscript+8r0   r   rR   r   r   r   )	descriptorIndex
scriptSlotscriptVaHexr   r   r   r   r   r   )
rs   r.   rM   DESCRIPTOR_SCRIPT_SCAN_DWORDSr8   r   rN   r   r    r	   )r4   r5   r   descriptor_scriptsrQ   
descriptorfield	slot_name	script_varR   r   r   rX   s                r   descriptor_script_mutation_rowsr     s    D(,,-=>D" 
!
 	E9
 "*.."78I <= #eai/ h8=!88'1~~g'>"+#(#3!&!&w %e"&v,*/7*:\ZbdiMjMv	  }E";;u-
 
	8 Kr   c                $   | j                  d      xs g }g }|D ]-  }|j                  d      xs g }||vs|j                  |       / | j                  d      | j                  d      xs g || j                  d      | j                  d      dS )N
sampleRowsactiveDescriptorIndicessampleCountuniqueSampleSignaturescurrentFrontierSelectorcurrentFrontierSampleCovered)r   r   sampleActiveDescriptorSetsr   r   )rs   rN   )sample_order_effectssample_rowsdescriptor_setsrt   actives        r   sample_order_summaryr   E  s    &**<8>BK')O +239r(""6*+
 ,//>"6":":;S"T"ZXZ&5#7#;#;<U#V(<(@(@A_(` r   c                   t        |       }t        | |      }||nt        t        dz  i       }||nt        t        dz  i       }||nt        t        dz  i       }||nt        t        dz  g       }t	        | |      }t        | |      }t        | |||      }	t        | |||      }
t        |      }d}i dt        dt        dd	d
dddddd|dt        ||      d|d|	dt        |	      dt        d |	D              d|
dt        |
      dt        d|dt        |
      dk(  ddddt        t         t"        t        t"              d|d
S ) Nsave_loader_trace.json.save_selector_opcode20_descriptor_scripts.json0save_selector_opcode20_sample_order_effects.jsonsave_selector_leaf_streams.jsona  The active order/count path is now separated from the save-selector stream. Save load materializes descriptor pointers by calling 0x00432323 after the save blocks are read and before the selector pointer is chosen. Later add/remove mutations are general nested-script opcodes 0x62/0x63 through table 0x00440538. The current selector 2:0 leaf rows with low byte 0x63 are CNS/resource words decoded through the save-selector table, not the general remove handler, and the scanned opcode 0x20 descriptor scripts contain no general 0x62/0x63 rows. This removes an opcode 0x20 self-mutation path, but it still does not prove the current selector 2:0 active order because public samples cover selectors 0:0, 1:0, and 22:0 only.sourcerO   r   z2:0countRuntimeVaHex
0x004576e8orderBytesVaHex
0x004576e9slotBaseHex
0x00457750r   loadRebuildEvidencehandlerTablescurrentRouteSameLowByteRowscurrentRouteSameLowByteRowCount(currentRouteGeneralMutationEvidenceCountc              3  ,   K   | ]  }|d    s	d  yw)r   r
   Nr   ry   s     r   rC   z build_summary.<locals>.<genexpr>  s     7xcSVWvSw7xs   
descriptorScriptMutationRows descriptorScriptMutationRowCountdescriptorScriptScanDwordCountsampleOrderSummary"opcode20SelfMutationPathEliminatedr   Fblocked)
 currentFrontierActiveOrderProvencontrolPathProofStatus
proofFound%opcode20RuntimeMaterializerProofFound(failedOpcode20RuntimeMaterializerGateIdsmissingEvidenceevidenceRefsevidenceRefCountpromotionStatus
conclusion)r   r   r*   OUTru   r   r   r   r   SOURCETARGETr   r1   sumr   -FAILED_OPCODE20_RUNTIME_MATERIALIZER_GATE_IDS.OPCODE20_RUNTIME_MATERIALIZER_MISSING_EVIDENCE+OPCODE20_RUNTIME_MATERIALIZER_EVIDENCE_REFS)r4   r   r   r   r   r5   r   r   handler_table
route_rowsdescriptor_mutationssample_summaryr   s                r   build_summaryr  U  s    S!HsH-G->-J)PYZ]`xZxz|P} ) 	sMMrR   + 	sOOQST 
 $0#;<3QrKrtvAwL%c84M h/M,S(G\RJ:3'Sef)*>?N	l && 	"5 	\	
 	< 	| 	 	45FV 	 	&z 	*3z? 	3C7xZ7x4x 	'(< 	+C0D,E 	)*G  	n!" 	-c2F.G1.L#$ -2"+164aIC KL$ 7 r   c                   | d   }| d   }ddd| d    d| d    d	| d
    dd| d    dd| d    dd| d    dd|d    d|d    dd|d    d|d    d| d    d| d    d| d    d | d!    d"| d#    d$| d%    dd&| d'    dd(| d)    dd| d*   dd+dg}|j                  d, | d-   D               |j                  g d.       |j                  d/ | d0   D               |j                  g d1       |j                  d2 | d3   D               |j                  g d4       | d5   }|d6   D ],  }|j                  d7|d8    d9|d:    d9|d;    d<|d=    d>	       . |d?   D ],  }|j                  d@|dA    d9|d:    d9|d;    d<|d=    d>	       . |j                  g dB       | dC   D ]N  }dDj                  dE |dF   D              xs dG}|j                  dH|dI    dJ|dK    d9|dL    d<| dM|dN    d>       P |j                  g dO       | dP   d dQ D ]Z  }|j                  dR|dS    dT|dU    dJ|dV    d9|dW    d<|dX    dY|j                  dZ      xs d dJ|d[    d9|d\    d<|d]    d>       \ | dP   s|j                  d^       |j                  dd_dd`|j                  da       dbdDj                  |j                  dc      xs g        dd|j                  de       df|j                  dg       dg       dhj                  |      S )iNr   r   z1# Save Selector Opcode 0x20 Runtime Materializers z	- route: r   z -> rO   z- current frontier selector: `r   `z- count byte: `r   z- order bytes: `r   z- slot base: `r   z- load rebuild call: `r|   z` -> `r}   z"- rebuild after save read blocks: r   z-- rebuild before selector pointer selection: r   z$- current route same-low-byte rows: r   z0- current route general mutation evidence rows: r   z5- descriptor script general 0x62/0x63 mutation rows: r   z-- opcode 0x20 self-mutation path eliminated: r   z(- current frontier active order proven: r   z- proofFound: `r   z*- opcode20RuntimeMaterializerProofFound: `r   z- promotion status: `r   r   z## Failed Gatesc              3  (   K   | ]
  }d | d  yw)- `r  Nr   rB   items     r   rC   zmarkdown.<locals>.<genexpr>  s     _43tfA_s   r   )r  z## Missing Evidencer  c              3  &   K   | ]	  }d |   yw)z- Nr   r
  s     r   rC   zmarkdown.<locals>.<genexpr>  s     D2dVD   r   )r  z## Evidence Refsr  c              3  8   K   | ]  }d |d    d|d      yw)r	  r   z`: r   Nr   ry   s     r   rC   zmarkdown.<locals>.<genexpr>  s/       c&k]#c-012s   r   )r  z## Handler Tablesr  z#| table | opcode | handler | role |z| --- | --- | --- | --- |r   r   z| general `r   z` | `rY   r[   z` | r   z |r   z| save-selector `r   )r  z## Materializersr  z9| name | function | core label | direct calls | meaning |z| --- | --- | --- | --- | --- |r   , c              3  &   K   | ]	  }|d      ywrK   Nr   rB   calls     r   rC   zmarkdown.<locals>.<genexpr>       P${+Pr  rm   -z| r;   z | `rd   re   z | rj   )r  z### Current Route Same-Low-Byte Rowsr  zS| stream | word | value | kind | save-selector handler | general handler | reason |z+| --- | --- | --- | --- | --- | --- | --- |r      z| `r   z` r   r   r   r    r   r   rg   r   z| - | - | - | - | - | - | - |z## Public Sample Orderz- sample count: r   z- unique signatures: r   z- active descriptor sets: r   z#- current frontier sample covered: r   
)extendrN   joinrs   )summaryloadsamplelinestablesrt   callss          r   markdownr!    s   ()D)*F;

GH%&d78+<*=>
(1J)K(LAN
'"567q9
7#456a8
/02
 &8!9 :&F\A]@^^_`
,T2N-O,PQ
7=d8e7fg
.w7X/Y.Z[
:7Cm;n:op
?Hj@k?lm
7@d8e7fg
27;]3^2_`
',/02
4W=d5e4ffgh
(9 :;1=


/E2 
LL_73]+^__	LL  
 
LLD1B)CDD	LL  
 
LL >*  
LL   _%F/0 
&!;<=U3{CSBTTYZ]^lZmYnnrsv  xF  tG  sH  HJ  K	

 78 
'F GHcR]N^M__dehiwexdyy}  B  CQ  R  ~S  SU  V	

 
LL   ' 
		P<N8OPPWTWVT#&:";!<E#FVBWAXX\]b\ccfgjktgufvvxy	


 
LL   45cr: 
#m$%RL(9':$s;?O>PPUVYZdVeUffj; #''%."6B!7tC@Z<[;\ ])*+4HbB	

 0145	LL
 

6::m456
		&**5M*N*TRT UVW
$VZZ0L%M$NO
-fjj9W.X-YZ
	 	 99Ur   c                
   | d   }g }|d   D ]|  }|j                  dt        j                  |d          dt        j                  |d          dt        j                  |d   xs d       d	t        j                  |d
          d	       ~ |d   D ]|  }|j                  dt        j                  |d          dt        j                  |d          dt        j                  |d   xs d       d	t        j                  |d
          d	       ~ g }| d   D ]  }dj                  d |d   D              xs d}|j                  dt        j                  |d          dt        j                  |d          dt        j                  |d          d	t        j                  |       dt        j                  |d          d        g }| d   d d D ]  }|j                  dt        j                  |d          dt        j                  |d          dt        j                  |d           dt        j                  |d!          d	t        j                  |d"          d#t        j                  |j	                  d$      xs d%       dt        j                  |d&   xs d       dt        j                  |d'   xs d       d	t        j                  |d(          d        | d)   }| d*   }d%j                  d+ | d,   D              }	d%j                  d- | d.   D              }
d%j                  d/ | d0   D              }d1j                  g d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFt        j                  | dG          dHt        j                  | dI          dJt        j                  | dK          dLt        j                  |dM   xs d       dN| dO    dP| dQ    dR| dS    dTt        j                  t        | dU                dVt        j                  | dW          dXdYt        j                  | dZ          d[d\d]|	 d^d_d]|
 d^d`d]| d^dadbd1j                  |      dcddded1j                  |      dcdfdgd1j                  |      xs dhdcdidj|j	                  dk       dlt        j                  dj                  |j	                  dm      xs g              dnt        j                  t        |j	                  do                   dp|j	                  dq       dr	dsdtd%      S )uNr   r   z<tr><td>general <code>r   z</code></td><td><code>rY   r[   r  z</code></td><td>r   z
</td></tr>r   z<tr><td>save-selector <code>r   r   r  c              3  &   K   | ]	  }|d      ywr  r   r  s     r   rC   zhtml_page.<locals>.<genexpr>  r  r  rm   z<tr><td>r;   z</td><td><code>rd   re   z	</td><td>rj   r   0   z<tr><td><code>r   z</code> r   r   r   r   r  r   r  r   rg   r   r   r   c              3  N   K   | ]  }d t        j                  |       d  yw)
<li><code>z</code></li>Nhtmlescaper
  s     r   rC   zhtml_page.<locals>.<genexpr>(  s+       T[[&'|4   #%r   c              3  N   K   | ]  }d t        j                  |       d  yw)z<li></li>Nr'  r
  s     r   rC   zhtml_page.<locals>.<genexpr>,  s+       t{{4 !'r*  r   c              3     K   | ]9  }d t        j                  |d          dt        j                  |d          d ; yw)r&  r   z	</code>: r   r,  Nr'  ry   s     r   rC   zhtml_page.<locals>.<genexpr>0  sE       T[[V-.iCDV8W7XX]^s   ?Ar   r  z<!doctype html>z<html lang="en">z<head>z  <meta charset="utf-8">zF  <meta name="viewport" content="width=device-width, initial-scale=1">z@  <title>Save Selector Opcode 0x20 Runtime Materializers</title>z	  <style>zg    :root { color-scheme: dark; font-family: system-ui, sans-serif; background: #101010; color: #eee; }z&    body { margin: 0; padding: 24px; }z,    h1 { margin: 0 0 8px; font-size: 24px; }z/    h2 { margin: 24px 0 8px; font-size: 18px; }z<    p { max-width: 1120px; color: #bbb; line-height: 1.45; }z[    table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 13px; }zi    th, td { border-bottom: 1px solid #303030; padding: 7px 8px; text-align: left; vertical-align: top; }zF    th { position: sticky; top: 0; background: #181818; color: #ddd; }z    code { color: #d7f0ff; }z
  </style>z</head>z<body>z:  <h1>Save Selector Opcode 0x20 Runtime Materializers</h1>z  <p>route r   z -&gt; rO   z; current selector <code>r   z!</code>; load rebuild call <code>r|   z"</code>; descriptor mutation rows r   z-; opcode 0x20 self-mutation path eliminated: r   z(; current frontier active order proven: r   z; proofFound <code>r   z </code>; promotion status <code>r   z</code>.</p>z  <p>r   z</p>z  <h2>Failed Gates</h2>z  <ul>z</ul>z  <h2>Missing Evidence</h2>z  <h2>Evidence Refs</h2>z  <h2>Handler Tables</h2>zb  <table><thead><tr><th>table</th><th>opcode</th><th>handler</th><th>role</th></tr></thead><tbody>z  </tbody></table>z  <h2>Materializers</h2>z~  <table><thead><tr><th>name</th><th>function</th><th>core label</th><th>direct calls</th><th>meaning</th></tr></thead><tbody>z+  <h2>Current Route Same-Low-Byte Rows</h2>z  <table><thead><tr><th>stream</th><th>word</th><th>value</th><th>kind</th><th>save-selector handler</th><th>general handler</th><th>reason</th></tr></thead><tbody>z<tr><td colspan="7">-</td></tr>z  <h2>Public Sample Order</h2>z  <p>sample count r   z; unique signatures r   z; active descriptor sets r   z"; current frontier sample covered r   z.</p>z</body>z</html>)rN   r(  r)  r  rs   str)r  r  r   rt   materializer_rows_htmlr   route_rows_htmlr  r  failed_gatesmissing_evidenceevidence_refss               r   	html_pager4    s   _%FL/0 
$T[[8R1S%T$U VS%567 8S%8%?C@A B;;s>234J@	

 78 
*4;;v>]7^+_*` aS%567 8S%8%?C@A B;;s>234J@	

  ' 

		P<N8OPPWTW%%;;s6{+, -S)=%>?@ AS)9%:;< =;;u%& ';;s9~./ 0	


 O45cr: 
S%789$++cR^N_B`Aa bS%567 8S_56 7;;s;/014;;swwu~?SQS3T2U VS)C%D%KLM NS)>%?%F3GH I;;s8}-. /
	

 )*F()D77 FG L ww -.  GG >* M 99 ... 	. 	#	.
 	Q. 	K. 	. 	r. 	1. 	7. 	:. 	G. 	f. 	t. 	Q.  	'!." 	#.$ 	%.& 	'.( 	E).* dkk'("345WT[[QYIZ=[<\\uvz  wB  wB  CJ  Kd  Ce  wf  vg  gH  IM  IT  IT  UY  Zl  Um  Ut  qt  Iu  Hv  vX  Y`  aC  YD  XE  Er  sz  {_  s`  ra  aI  JQ  Rt  Ju  Iv  vI  JN  JU  JU  VY  Za  bn  Zo  Vp  Jq  Ir  rR	  S	W	  S	^	  S	^	  _	f	  g	x	  _	y	  S	z	  R	{	  {	G
  	H
+., GL12348-.. 	"/.0 e$1.2 	&3.4 !"%(5.6 	#7.8 u%9.: 	$;.< 	m=.> 			,?.@ 	A.B 	#C.D 	IE.F 			()G.H 	I.J 	6K.L 	oM.N 			/"G&GO.P 	Q.R 	)S.T VZZ677KDKKX\XaXabhblbl  nF  cG  cM  KM  YN  MO  LP  Pi  jn  ju  ju  vy  z@  zD  zD  Ea  zb  vc  jd  ie  eG  HN  HR  HR  Sq  Hr  Gs  sx  	yU.V 	W.X 	Y.Z 	[. . .r   c                    |j                  dd       |dz  j                  t        j                  | dd      dz   d	       |d
z  j                  t	        |       d	       y )NT)parentsexist_okz1save_selector_opcode20_runtime_materializers.jsonF   )ensure_asciiindentr  r"   r#   1save_selector_opcode20_runtime_materializers.html)mkdir
write_textr&   dumpsr4  )r  out_dirs     r   write_outputsr@  e  sf    MM$M.BBNN

7q9D@ O  BBNNyY`OalsNtr   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               | j                         }t        |j                  j                         t        |j                  i       t        |j                  i       t        |j                  i       t        |j                  g             }t!        ||j"                         t%        d|j"                  dz          y )N)r   z--exer   )typedefaultz--save-loader-tracer   z--descriptor-scriptsr   z--sample-order-effectsr   z--leaf-streamsr   z	--out-dirz+wrote opcode 0x20 runtime materializers -> r;  )argparseArgumentParser__doc__add_argumentr   ROOTr   
parse_argsr  r4   
read_bytesr*   r   r   r   r   r@  r?  print)parserargsr  s      r   mainrN  n  sD   $$9F
dD=4HI
-D#H`B`a
.T3IyCyz
0tSK}E}~
(tSCd=de
$<D$(("-$))2.$++R0$##R(G '4<<(	7Gz8z7{
|}r   __main__)r   r-   returnr.  )r   r   r)   r   rP  r   )r   
str | NonerP  
int | None)r4   bytesr5   
list[dict]r6   r-   rP  rR  )r5   rT  r6   rR  rP  rQ  )r4   rS  r5   rT  rP  ztuple[int, bytes])r4   rS  r5   rT  rO   r-   rP  rT  )
r4   rS  r5   rT  r]   r-   rX   r-   rP  dict)r4   rS  r5   rT  rP  rT  )r   rU  r   rT  rP  rU  )r4   rS  r5   rT  rP  rU  )
r   rU  r   dict[int, str]r5   rT  r   r-   rP  r.  )
r4   rS  r5   rT  r   rV  r   rT  rP  rT  )
r4   rS  r5   rT  r   rV  r   rU  rP  rT  )r   rU  rP  rU  )NNNN)r4   rS  r   dict | Noner   rW  r   rW  r   zlist[dict] | NonerP  rU  )r  rU  rP  r.  )r  rU  r?  r   rP  None)rP  rX  )@rF  
__future__r   rD  r(  r&   r2   syspathlibr   typingr   r   insertr.  __file__resolveparentprobe_exe_scene_tablesr   r   r   r	   r6  rH  r   r   r   r   r   ro   rp   rq   rr   LOAD_REBUILD_CALLr   r   r   r   r   r   r   r   r    r*   r.   r8   r?   rG   rV   r`   ru   r   r   r   r   r   r   r  r!  r4  r@  rN  __name__r   r   r   <module>rd     sP   N "     
   3tH~--/667 8 ^ ^ H~''*
Ul		( " % ' ", (    # &  " 1 -2 . +kl):klA  S^  _CT}~2  DQ  R/ +8-4I
"	2j"J*'	'' ' 	'
 'T#	## # 	#
 #L$ &*&*(,&*@	@"@ $@ &	@
 $@ 
@FaHfR 25 u~( zF r   