# run link100, lane PMFB8 -- THE ROWS PMFB7 MEASURED AND LEFT ON THE CLOCK.
#
# ===========================================================================
# GATE 1 -- func_ov055_021112c4, MirrorLuigi's ENTER DISPATCHER
# ===========================================================================
#
# THE UNIVERSE IS CLOSED, over the same class-derived block gates 1 and 2 of
# lane PMFB7 used: every function symbol in ov055's symbols.txt whose mangled
# name names MirrorLuigi, first to last, is 021111a0..02111860, and that is the
# span one translation unit emits. Every `load` relocation in ov055 landing in
# that block whose word reads the target and whose FOLLOWING word is zero gives
# exactly TWO pairs:
#
#     02111a94  code=021112bc  (the ENTER half, whose whole body is `return 1`)
#     02111a9c  code=02111288  (the TICK half, the mirror of the player)
#
# run 02111a94..02111aa4, SOLID, two distinct code words, and the only two
# references into the run are 02111904 and 02111908 -- __sinit_ov055_021118d4's
# own loads, the class's own sinit, which copies both pairs into the sixteen-
# byte cell at data_ov055_02111b70. Nothing else in ov055 can hand this field an
# address. (runs/link100/out/PMFB8/sweep_g1.txt)
#
# WHAT MAKES THIS ROW DIFFERENT FROM PMFB7's TWENTY-ONE, and why it was left for
# its own gate: ITS ARITY IS ONE. The /FAsc listing under the port's own flags
# (runs/link100/out/PMFB8/emit_g1_out.txt) is
#
#     mov  DWORD PTR [eax+472], ecx     c->pp = p, 472 = 0x1d8
#     mov  edx, DWORD PTR [ecx]         the pair's FIRST word
#     test edx, edx / jne               the null test the ROM also makes
#     mov  ecx, DWORD PTR [ecx+4]       the pair's SECOND word, the adjust
#     push DWORD PTR _a2$[ebp]          ONE stack argument
#     add  ecx, eax                     receiver = this + adjust
#     call edx
#     pop  ebp / ret 0                  the caller does NOT clean up after it
#
# A CALL, not a tail jump, with one pushed word the caller never pops, because
# __thiscall's stack half is callee-popped. So the face is
# __fastcall(self, dead_edx, int) -- lane FWD's MgCup shape -- which takes ecx
# as its receiver and pops the same one word. /Zp4 changes 0 listing lines
# outside the TITLE and is NOT claimed: the member sits at offset 0 of the
# record. The EXTRN list is EMPTY, so this row needs no /alternatename and no
# forwarder; its src defines the flat C name the port already calls.
#
# THE SECOND READER WAS MEASURED BEFORE THE SEAT, which is what an arity-one row
# costs that the uniform rows did not. The same cell has TWO halves and TWO
# readers: this row reads the pair at cell+0 (the enter half) and
# port/unmatched/MirrorLuigi_Behavior.cpp -- still a host copy -- reads the pair
# at cell+8 (the tick half) as a plain cdecl (self, arg) call. They are
# DISJOINT records, so the enter word takes the __fastcall face and the tick
# word keeps the cdecl body it already has. Nothing compares a stored pair by
# value, so there is no by-value sentinel and no one-face-per-code-word
# constraint here.
#
# THE SEAT IS ON THE CELL, not on the source pairs, because port_ov55_bringup
# already runs __sinit_ov055_021118d4 and then port_mirrorluigi_state_seat in
# that order, and the seat already verifies all four mounted ROM words before it
# rewrites anything -- the MgCup shape, one file over. Only the ENTER word
# changes: it stops being the raw cdecl func_ov055_021112bc and becomes the
# __fastcall face the matched TU's own `call edx` needs.
src/func_ov055_021112c4.cpp

# ===========================================================================
# GATE 2 -- THE func_-NAMED ROWS, BY THE CLASS'S OWN VTABLE
# ===========================================================================
#
# Six rows whose own symbol is func_ovNNN_xxxxxxxx, so no mangled name names
# their class and lane PMFB7's name-derived block cannot be read off
# symbols.txt. Gate 3 of that lane derived an ov006 class's block from its
# VTABLE instead -- every slot word that lands in the overlay and is not the
# shared base's is a body this class defines, and the block is the first-to-last
# span of those bodies snapped out to the enclosing symbol boundaries -- and
# that derivation generalises to any overlay
# (runs/link100/out/PMFB8/ovblock.py, PMFB7's clsblock.py with the ov006
# hard-coding removed). THREE OF THE SIX CLOSE AND ARE TAKEN. THREE DO NOT AND
# ARE REFUSED BELOW, each with the measurement that stops it.
#
#   row                    vtable      class code block        pairs  run
#   _ZN12daBakubaku_c8BehaviorEv   02113824   021111a0..0211244c      10   0211377c..021137cc
#   _ZN4Door8BehaviorEv   02148188   021443f4..0214589c      15   021480d4..0214814c
#   func_ov100_021453d8   02148188   the same block, the same fifteen records
#
# ---- _ZN12daBakubaku_c8BehaviorEv, BUBBA'S TICK DISPATCHER -------------------------
#
# ov032 holds three classes and dsd named only two of them; id 228 BUBBA is the
# unnamed one, so every symbol it owns is func_ov032_*. Its vtable is 0x02113824
# (hal/actor_classes_ov055.cpp's sibling file states the three-route
# attribution: the factory, the RTTI string 12daBakubaku_c, and the SpawnInfo
# record), 31 slots, EIGHT of which are its own ov032 bodies, and the
# first-to-last span of those snapped to symbol boundaries is
# 021111a0..0211244c. The sweep over it returns exactly TEN {code,0} pairs at
# 0211377c..021137c4, ONE SOLID RUN, ten distinct code words, and every
# reference into the run is one of __sinit_ov032_02112c10's own ten loads.
# Those ten are the five {enter, tick} pairs the sinit copies into the five
# sixteen-byte cells hal/actor_classes_ov032.cpp already seats and verifies.
# The universe CLOSES. (runs/link100/out/PMFB8/sweep_g2_ov032.txt)
#
# THE EMITTED SIDE, off the TU's own /FAsc listing under the port's own flags:
#     mov eax,[ecx+8] / test eax,eax / mov ecx,[ecx+12] / add ecx,esi /
#     call eax
# -- the member at offset 8 of the record, which is the tick half, receiver in
# ecx, ARITY ZERO, no push and no cleanup. So the five TICK words take zero-arg
# __fastcall faces. /Zp4 changes 0 listing lines outside the TITLE and is not
# claimed: the member sits at offset 8 of its holder, 0 mod 8.
#
# THE FIVE ENTER WORDS ARE NOT TOUCHED, and the reason is measured rather than
# assumed. Their dispatcher, src/game/actors/d_a_bakubaku.cpp, is ALREADY in the link
# (port/slice_pmf2.txt) and its emitted transfer is `jmp edx`, a TAIL JUMP: the
# caller's own frame survives, so the cdecl body reads the caller's first stack
# word, which is `c` -- exactly self. That is lane PMFB7's reading of why the
# enter halves of its twenty-one rows stayed raw, reproduced here on this
# overlay (runs/link100/out/PMFB8/ctl_emit.json). It is also why MirrorLuigi's
# gate-1 row needs a face and this overlay's enter half does not: an extra
# argument stops MSVC tail-jumping, and a CALL does not carry the caller's
# frame.
#
# NOTHING COMPARES A STORED PAIR BY VALUE in this class. The three other readers
# of the field -- src/game/actors/d_a_bakubaku.cpp, _02111350.c and _021113fc.cpp, and
# the row's own `!= data_ov032_02113aac` test -- all compare the CELL POINTER,
# not a function word, so there is no by-value sentinel and no
# one-face-per-code-word constraint.
#
# ---- func_ov100_021453d8 AND _ZN4Door8BehaviorEv, THE DOOR'S TWO HALVES ---
#
# daDoor_c's vtable is 0x02148188 (dsd's own, and inferred_stub_adjudicated.txt
# names it for slot 6), 34 slots, SEVEN of which are its own ov100 bodies, and
# the block is 021443f4..0214589c. The sweep returns exactly FIFTEEN {code,0}
# pairs at 021480d4..02148144, ONE SOLID RUN, fourteen distinct code words
# (0x02144730 is held twice), and every reference into the run is one of
# __sinit_ov100_02147698's own fifteen loads. That is precisely the set
# port/unmatched/Door_Behavior.cpp already enumerated by hand, derived this time
# from the class rather than read off a host file.
# (runs/link100/out/PMFB8/sweep_g2_ov100.txt)
#
# THE TWO ROWS ARE THE TWO HALVES OF ONE NODE. The sinit builds nine 0x10-byte
# nodes out of those fifteen statics plus arm9's data_02086b58, the NULL pair;
# 021453d8 seats the node at c+0x140 and dispatches the pair at node+0,
# 02145550 dispatches the pair at node+8 every frame. Both test word 0 against
# zero first, so the null node stays safe.
#
# BOTH ARE ARITY ONE and their emitted sides agree word for word:
#     021453d8   mov edx,[ecx] / test / mov ecx,[ecx+4] / push a2 /
#                add ecx,eax / call edx
#     02145550   mov edx,[ecx+8] / test / mov ecx,[ecx+12] / push eax /
#                add ecx,esi / call edx
# one pushed word neither caller pops, receiver in ecx. So ONE face shape serves
# both halves: __fastcall(self, dead_edx, void *arg), fourteen faces for
# fourteen code words. /Zp4 changes 0 listing lines on either TU. EXTRN is empty
# on 021453d8 and _func_ov100_02145370 on 02145550, which is already in the link
# through port/slice_gate22.txt, so neither row needs an /alternatename.
#
# THE ARGUMENT COUNT OF THE BODIES IS THE ARM RIDE-THROUGH ALREADY RULED ON.
# Nine of the fifteen bodies take two words and six take one; Door_Behavior.cpp
# declares all fifteen as (void *, void *) because the caller cleans under
# __cdecl and r1 is set whether or not the callee reads it. The faces keep that
# ruling exactly: each face pops its own one stack word (that is what __fastcall
# does) and then calls its body cdecl with (self, arg).
#
# THE .text-BOUNDS REFUSAL THAT GOES AWAY WITH THE HOST COPY IS A STALE GUARD,
# and this is the one thing in this gate that had to be read out of history
# rather than measured. Door_Behavior.cpp says a non-code callback appeared in
# real play on 2026-08-07 and that the refusal stands "until that write is
# found". It was found in the SAME commit that added the refusal: 34285a74f
# ("port: the door ring's thiscall aliases were stack corruption - real faces")
# names the cause -- gate-22 aliases bound cdecl callers onto __thiscall bodies,
# so GoBehindPlayer's `ret 4` inside func_ov100_02144730 shifted the frame and
# its epilogue returned onto the door argument -- and fixed it with nine cdecl
# faces. The diagnostics were kept as diagnostics, not as a live shield. What
# survives the seat is stronger than what goes: port_door_callbacks_seat still
# verifies all fifteen mounted ROM words before it writes a single face, and
# both matched TUs keep the ROM's own null test.
#
# ---- WHAT IS NOT TAKEN, AND THE MEASUREMENT THAT STOPS EACH ---------------
#
# func_ov002_020bd664 -- ITS UNIVERSE CLOSES; THE SEAT NEEDS A CALL SITE THIS
#   LANE DOES NOT OWN. This row is not a field row at all: it is a fourteen-slot
#   TABLE the src NAMES, `static PMF table[14] = { data_ov002_0210a14c, ... }`,
#   indexed by the kuppa script byte p[6]. So the universe is explicit rather
#   than swept, and it is closed: all fourteen read {code, 0} in the ov002
#   image, fourteen distinct code words, and the ONLY references to any of the
#   fourteen anywhere in ov002 are the row's own fourteen literal-pool loads at
#   020bd7ec..020bd824. Nothing else -- no sinit, no second dispatcher -- can
#   see them. The fourteen sit INSIDE the much larger .data run that also holds
#   Player's state records, which is exactly why an address-range sweep would
#   have been wrong here and the source's own names are right.
#   (runs/link100/out/PMFB8/sweep_g2_ov002.txt)
#   THE EMITTED SIDE is `mov ecx,[table+edx*8+4] / add ecx,self /
#   mov eax,[table+edx*8] / push a3 / push a2 / push p+7 / call eax` -- stride
#   eight, receiver in ecx, ARITY THREE, /Zp4 0 diff lines.
#   WHAT STOPS IT: hal/intro_kuppa_dispatch.cpp deliberately does NOT rewrite
#   the mounted words -- it resolves at the dispatch site, and its own header
#   says that is what buys it "no seat ordering to get wrong". Seating the
#   matched TU inverts that: MSVC copies the fourteen pairs into a function
#   static on the FIRST call, so the records must already hold faces by then,
#   which needs a seat call in ov002's bring-up. That file is not this lane's,
#   and a static initialiser cannot substitute because the overlay mount is
#   filled at overlay-load time and would overwrite it. The row also needs
#   fourteen /alternatename rows (MSVC decorates every one of the fourteen
#   `extern PMF` names, e.g. ?data_ov002_0210a14c@@3P8C@@AEXPAEHH@ZQ1@) and
#   drags in MSVC's magic-static guard (__Init_thread_header/footer/epoch,
#   __tls_index, __tls_array). Both are ordinary work; the call site is the
#   blocker.
#
# func_ov075_0211a194 and _ZN10dScEntry_c6RenderEv -- THE RECORD SET IS NOT A
#   UNIVERSE. Both read a pair out of the OBJECT itself: 0211a194 copies six
#   words from a source record into self+0x54..0x68 and dispatches the pair at
#   +0x54, and 0211a26c dispatches the pair at +0x64. So the universe is the set
#   of six-word source records the setter is ever handed, and it does not close:
#   thirteen ROM call sites reach 0211a194, nine pass a NAMED record and TWO
#   pass `*(void **)(self + 0x6c)` -- a FIELD -- so the set cannot be read off
#   the call sites at all. Worse, every named record is PAST THE END OF THE
#   ov075 IMAGE (it ends at 0211d380): they are .bss, built at run time by the
#   overlay's sinits out of a source run that sweeps to SIXTY-SEVEN {code,0}
#   pairs with EIGHTEEN GAPS. That is a count, not a universe -- lane PMFB7's
#   Player::ChangeState refusal, one overlay over.
#   (runs/link100/out/PMFB8/sweep_g2_ov075.txt)
#   TWO THINGS ARE BANKED ANYWAY. /Zp4 IS REQUIRED on
#   src/_ZN10dScEntry_c6RenderEv.cpp and this is the fifth confirmation of PMFB6's
#   rule: its struct spells `char pad[0x64]; PMF pp[1];` and 0x64 mod 8 = 4, so
#   without the option MSVC reads [eax+104]/[eax+108] -- 0x68 and 0x6c, four
#   bytes late -- and with it [eax+100]/[eax+104], the ROM's own 0x64/0x68. Two
#   listing lines differ and nothing else. And the seat is not this lane's file
#   either way: those words are written by hal/scene_vs_menu.cpp's GENERATED
#   vs_data_patch.inc, whose own header says regenerate rather than hand-edit,
#   and one of the three record pairs points at src/func_ov075_0211b1cc.c, a
#   body that still carries the "recovered from vtable slot identity" marker
#   with no REAL_DECOMP ruling -- which port/tools/inferred_stub_guard.py
#   forbids seating, and is right to.
src/game/actors/d_a_bakubaku.cpp
src/func_ov100_021453d8.cpp
src/game/actors/d_a_star_gate.cpp

# ===========================================================================
# GATE 3 -- func_ov006_020c07e8, THE MODEL SUB-OBJECT'S +0xb4 FIELD
# ===========================================================================
#
# THE UNIVERSE WAS CLOSED BY LANE MGWRITER AND RE-READ HERE. The model
# sub-object's pairs are one contiguous run of ov006 .data, 0213ac48..0213acb8,
# fifteen {code, 0} records serving TWO disjoint fields, and this row's field is
# the +0xb4 half: FOUR records -- 0213ac68, 0213ac70, 0213ac78, 0213ac88 --
# holding TWO code words, 0x020c0264 and 0x020c0364. The other eleven serve
# func_ov006_020c19d0's +0x00 field and lane MGWRITER already seated them; the
# two code-word sets are disjoint, so neither half can hand the other a host
# word.
#
# 0213ac78 IS A BY-VALUE SENTINEL that this row reads itself: its last statement
# is `int *g = data_ov006_0213ac78; if (p[0] == g[0]) { if (p[1] == g[1])
# return; ... }`, an idle test comparing the stored pair against that record's
# contents. So this row is ONE FACE PER CODE WORD -- two faces over four
# records -- and both sides of the comparison move together, which is what keeps
# the idle test answering what it answered on the cartridge.
#
# /Zp4 IS REQUIRED, and this is the sixth confirmation of PMFB6's rule. The ROM
# reads the pair at `add r3, r6, #0xb4` (0x020c07f4); 0xb4 mod 8 = 4, MSVC
# aligns the eight-byte member to eight, and without the option the TU emits
# `mov ecx,[esi+188] / mov eax,[esi+184]` -- 0xbc and 0xb8, four bytes late,
# a silent wrong read rather than a link error. With it: `mov ecx,[esi+184] /
# mov eax,[esi+180]` -- 0xb8 and 0xb4, the ROM's own. SIXTEEN listing lines
# differ and nothing else. Measured for this lane in
# runs/link100/out/PMFB8/emit_g3_out.txt, the same number lane PMFB7 measured.
#
# THE DISPATCH IS ARITY ZERO: `mov eax,[esi] / test eax,eax / mov ecx,[esi+4] /
# add ecx,esi / call eax`, receiver in ecx, nothing pushed, nothing cleaned. So
# the two faces are zero-argument __fastcall, the shape MGWRITER's eleven use.
#
# WHAT ACTUALLY STOPPED THIS ROW UNTIL NOW IS THE NULL PAIR, and it is settled
# by a COUNTED RUN rather than by an argument. Neither the ROM (fourteen
# instructions, no `cmp` before the `blx`) nor the matched src tests word 0
# before dispatching, so retiring the host copy takes away the
# `if (code == 0) return` that port_mg_memory2_field_call adds. Gate 3 step A
# put a counter in the host copy -- which stayed a host copy for exactly that
# gate -- counting every entry, every entry whose stored pair read {0, ...}, and
# the first pair seen, written out per process at exit.
#
# THE RESULT, over all 36 scene rows port/hal/scene_boot.cpp declares, each run
# with the battery's own environment (imported from port/tools/battery.py rather
# than re-spelled, so the two cannot drift), rc 0 on all 36:
#
#   c07e8 scene=362  dispatches=253  nullpairs=0  first={020c0364,0}
#   c07e8 scene=363  dispatches=253  nullpairs=0  first={020c0364,0}
#   c07e8 scene=379  dispatches=253  nullpairs=0  first={020c0364,0}
#   c07e8 scene=381  dispatches=253  nullpairs=0  first={020c0364,0}
#   c07e8 scene=382  dispatches=253  nullpairs=0  first={020c0364,0}
#   c07e8 scene=383  dispatches=253  nullpairs=0  first={020c0364,0}
#   c07e8 scene=388  dispatches=253  nullpairs=0  first={020c0364,0}
#
# SEVEN rows of the 36 reach the body, 1771 dispatches between them, ZERO with a
# null pair, and the FIRST pair each row sees is already {020c0364, 0}. The
# other 29 rows never reach it and write no line, which is that row's answer.
# The field is installed before anything dispatches it, on every path the
# battery exercises, so the guard this seat removes was never the thing standing
# between the port and a branch to zero.
# (runs/link100/out/PMFB8/c07e8_counted.txt)
#
# THE SEAT NEEDS NO NEW CALL SITE. The four records join
# port_mg_memory2_model_seat, which hal/scene_mg.cpp already calls at overlay
# load, before any scene of this family ticks; the seat verifies all four
# mounted ROM words and ABORTS on a disagreement before it writes a face.
#
# ONE /alternatename, read off the TU's own /FAsc EXTRN list before the link.
# src/func_ov006_020c07e8.cpp declares `extern Vector3 data_ov006_0212b890;`
# OUTSIDE its extern "C" block, so MSVC spells the reference
# ?data_ov006_0212b890@@3UVector3@@A while the ov006 mount defines the plain C
# name -- the same shape as this file's existing ?data_ov006_0212b89c@@3PAFA
# row, one symbol over. Nothing in the tree DEFINES that LHS, so the alias
# cannot be silently defeated. Every other name on that EXTRN list resolves
# already: _Vec3_HorzAngle, __Z11UpdateAngleRssis,
# __ZN14BlendModelAnim7AdvanceEv and _data_ov006_0213ac78 were each checked
# present in walk_window.map before the link, and ___security_cookie /
# @__security_check_cookie@4 are the CRT's /GS pair, which this TU needs because
# it has a local array.
src/func_ov006_020c07e8.cpp
