decomp(aoss): improve decrypt declaration allocation #1094

Merged
coah80 merged 1 commits from agent/bittle/aoss-decrypt-fuzzy-order into main 2026-10-03 11:33:53 +00:00
coah80 commented 2026-10-03 11:32:12 +00:00 (Migrated from github.com)

Minimal declaration-only gain

Swap the existing uninitialized controlFlags and secondValue declarations. All expressions, assignments, initializers, types, scopes, arrays/aggregates, helper calls, configuration and link settings remain fixed.

  • AOSSDecryptMessage: 97.74143% → 97.88162%, 321/321 instructions
  • Unit: 97.71665% → 97.72777%
  • Structural/positional score remains (0,87)
  • Exact functions 16/21, code 6436/16192, data 3928/3928 and link measures unchanged

One unchanged official declaration-search invocation performed baseline + all 287 unique immediate swap/move neighbors, then one restoration: 288 evaluations / 289 actual compiler snapshots. Parent independently regenerated all 289 official scores. The structural optimizer discarded the winning intermediate because its internal score tied baseline. The selected order lies within an older searched prefix; this is official-fuzzy recovery, not historical novelty. The selected winner's neighborhood is not claimed exhausted.

Independent verification on current main

Parent rebuilt a fresh review worktree on b41f95f9fe. Tested tree: faa4f04ce7.

  • All 1,027 unit/function reports checked; only AOSSDecryptMessage improves
  • All 20 sibling instruction/relocation streams, exact/code/data/link and allocated data preserved
  • Emitted changes are 18 register operands in three call-free regions. Symbolic evaluation of actual instructions confirms identical ordered memory events and exit register state; all 23 calls/arguments remain unchanged
  • Independently rerun production-function UBSan harness: candidate and baseline each pass 2,120 cases, all wire lengths 0–1472, independent cipher/CRC expectations, allocation failures, address/control errors, whole-packet publication and cleanup guards
  • Pool identical (1/1); literal audit checks 19 functions / 12 arguments with no errors. Existing unequal-size skips: AOSS_Init_old and AOSSSendHelloRequest
  • Full default build, report/progress, explicit 43U/ok, leaf and diff checks pass
  • DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d

The first parent build encountered a denied automatic tool download; no network retry was made. The same already-present, hash-verified pinned tools were explicitly selected through supported configure options, and the full offline build passed. Production flags and tools were unchanged.

Bounded symbolic/native diagnostics are not Wii hardware execution. Evidence and complete snapshot scores are in allhands-aoss-decrypt-declaration-order.attempts.md and its results.csv under tools/decomp-assist. No original binaries/disassembly included. Draft for human review; no merge or auto-merge requested.

Note

Swap declaration order of controlFlags and secondValue in AOSSDecryptMessage

Exchanges the declaration positions of two uninitialized local variables in AOSS.c. No assignments, types, or expressions changed. Adds an engineering report and redacted CSV results for the declaration-order experiment under tools/decomp-assist.

Macroscope summarized 3ca18ef.

## Minimal declaration-only gain Swap the existing uninitialized controlFlags and secondValue declarations. All expressions, assignments, initializers, types, scopes, arrays/aggregates, helper calls, configuration and link settings remain fixed. - AOSSDecryptMessage: 97.74143% → 97.88162%, 321/321 instructions - Unit: 97.71665% → 97.72777% - Structural/positional score remains (0,87) - Exact functions 16/21, code 6436/16192, data 3928/3928 and link measures unchanged One unchanged official declaration-search invocation performed baseline + all 287 unique immediate swap/move neighbors, then one restoration: 288 evaluations / 289 actual compiler snapshots. Parent independently regenerated all 289 official scores. The structural optimizer discarded the winning intermediate because its internal score tied baseline. The selected order lies within an older searched prefix; this is official-fuzzy recovery, not historical novelty. The selected winner's neighborhood is not claimed exhausted. ## Independent verification on current main Parent rebuilt a fresh review worktree on b41f95f9feb3a4d2b41bf926f80bced3bbec6983. Tested tree: faa4f04ce7a3792c052dbeb65c12fec774b95895. - All 1,027 unit/function reports checked; only AOSSDecryptMessage improves - All 20 sibling instruction/relocation streams, exact/code/data/link and allocated data preserved - Emitted changes are 18 register operands in three call-free regions. Symbolic evaluation of actual instructions confirms identical ordered memory events and exit register state; all 23 calls/arguments remain unchanged - Independently rerun production-function UBSan harness: candidate and baseline each pass 2,120 cases, all wire lengths 0–1472, independent cipher/CRC expectations, allocation failures, address/control errors, whole-packet publication and cleanup guards - Pool identical (1/1); literal audit checks 19 functions / 12 arguments with no errors. Existing unequal-size skips: AOSS_Init_old and AOSSSendHelloRequest - Full default build, report/progress, explicit 43U/ok, leaf and diff checks pass - DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d The first parent build encountered a denied automatic tool download; no network retry was made. The same already-present, hash-verified pinned tools were explicitly selected through supported configure options, and the full offline build passed. Production flags and tools were unchanged. Bounded symbolic/native diagnostics are not Wii hardware execution. Evidence and complete snapshot scores are in allhands-aoss-decrypt-declaration-order.attempts.md and its results.csv under tools/decomp-assist. No original binaries/disassembly included. Draft for human review; no merge or auto-merge requested. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Swap declaration order of `controlFlags` and `secondValue` in `AOSSDecryptMessage` > Exchanges the declaration positions of two uninitialized local variables in [AOSS.c](https://github.com/coah80/wii-ipl/pull/1094/files#diff-c9d178769a3c839c7dccd0eba548dd59c264dfe097f6aa29f6df6f8bb7546c98). No assignments, types, or expressions changed. Adds an engineering report and redacted CSV results for the declaration-order experiment under [tools/decomp-assist](https://github.com/coah80/wii-ipl/pull/1094/files#diff-8a31957c95cb259652fd404543400d8aaf390e1bfde48845e3e8c6c7553e9808). > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 3ca18ef.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 11:33:51 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.