feat(phase-32): T3 (9) — main: func_80038698 (74 ins) BANKED byte-identical 143dbb89 via gate_main — the "sched1 DAG-priority + self-coalesce wall" was VARIABLE SCOPE

- 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
This commit is contained in:
Drew T
2026-09-05 01:07:13 -06:00
parent 0276aaec68
commit 0240fa5f62
+59 -1
View File
@@ -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;