From 0240fa5f625d8b30d820754b1e42e8cb2d3c7bbf Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Sat, 5 Sep 2026 01:07:13 -0600 Subject: [PATCH] =?UTF-8?q?feat(phase-32):=20T3=20(9)=20=E2=80=94=20main:?= =?UTF-8?q?=20func=5F80038698=20(74=20ins)=20BANKED=20byte-identical=20143?= =?UTF-8?q?dbb89=20via=20gate=5Fmain=20=E2=80=94=20the=20"sched1=20DAG-pri?= =?UTF-8?q?ority=20+=20self-coalesce=20wall"=20was=20VARIABLE=20SCOPE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - gcc-2.7.2 runs local_alloc (single-block pseudos) BEFORE global_alloc (multi-block pseudos): the three BE-16 hi-bytes are ONE function-scope variable reused across blocks -> global_alloc's $a1 bank, cannot self-coalesce with the block-local shift dest (the target's `sll $v1,$a1,8` tell) — and its longer live range fixed the p[8]/p[7] sched1 hoist for free. The prior NEAR-11 drafts pinned hi=$5 at one site only. - plus an in-place compound on a block temp (u32 t = hi<<8; t |= p[11]) to tie the or to the shift (§219 family), and ONE pin register u32 len asm("$6") to rotate p/len (all 24 declaration orders inert, as this TU's func_80035270 notes) - MIDI MThd header parser; no relocations. rtu_match MATCH 74/74 (coordinator-verified); gate_main 1/1 BANKED - harvest: "multi-block variable = global_alloc bank" — a shift whose dest differs from its $aN source means a function-scope variable reused across blocks; no statement order reaches it from a per-site temp --- src/800_c.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/800_c.c b/src/800_c.c index 215959012..34e1064fe 100644 --- a/src/800_c.c +++ b/src/800_c.c @@ -2706,7 +2706,65 @@ void func_80038668(s32 a0, s32 a1) { *(baseptr + a1) &= 0xFE; } -INCLUDE_ASM("asm/nonmatchings/800_c", func_80038698); + +s32 func_80038698(void *arg0) { + u8 *p; + register u32 len asm("$6"); + u32 hi; + s32 div; + + p = *(u8 **)arg0; + *(u8 **)arg0 = p + 1; + len = p[0]; + *(u8 **)arg0 = p + 2; + len |= p[1] << 8; + *(u8 **)arg0 = p + 3; + len |= p[2] << 16; + *(u8 **)arg0 = p + 4; + len |= p[3] << 24; + if (len != 0x6468544D) { + return -1; + } + *(u8 **)arg0 = p + 5; + len = p[4]; + *(u8 **)arg0 = p + 6; + len <<= 8; + len |= p[5]; + *(u8 **)arg0 = p + 7; + len <<= 8; + len |= p[6]; + *(u8 **)arg0 = p + 8; + len <<= 8; + len |= p[7]; + hi = p[8]; + { + u32 s = hi << 8; + s |= p[9]; + if (s != 0) { + return -1; + } + } + hi = p[10]; + { + u32 t = hi << 8; + t |= p[11]; + if ((s16)t != 1) { + return -1; + } + } + hi = p[12]; + { + u32 u = hi << 8; + u |= p[13]; + div = (s16)u; + } + if (div & 0x8000) { + return -1; + } + *(u16 *)((char *)arg0 + 0x1E6) = div & 0x7FFF; + *(u8 **)arg0 += len; + return 0; +} s32 func_800387C0(void *arg0) { u8 *p;