Skip to content

[AUTOMATED] Preserve switch early returns at declared function ends - #916

Merged
mahaloz merged 10 commits into
Noelo-Lab:mainfrom
mgostIH:fix/switch-return-paths
Oct 5, 2026
Merged

mahaloz merged 10 commits into
Noelo-Lab:mainfrom
mgostIH:fix/switch-return-paths

Conversation

@mgostIH

@mgostIH mgostIH commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

The problem

Declaring the exact function end makes a switch's return-only entry and out-of-range inputs execute its last case. This probe should toggle byte 2 only for tag 3.

python3 - <<'PYCODE'
from pathlib import Path
code = bytes.fromhex('83fe0377334863c641b8000040008b1485002040004c01c2ffe2803f000f94c08807c3807f01000f94c0884701c3807f02000f94c0884702c3')
Path('/tmp/switch.bin').write_bytes(code.ljust(0x1000, b'\0') + bytes.fromhex('1a10000038100000231000002e100000'))
PYCODE
kuna decompile /tmp/switch.bin 0x401000 --raw-image \
  --target x86:LE:64:default:gcc --base 0x401000 --mode reliable \
  --assert 'function 0x401000-0x401039=toggle_dispatch' \
  --assert 'typedef struct ToggleFlags { bool first; bool second; bool last; };' \
  --assert 'prototype toggle_dispatch void toggle_dispatch(struct ToggleFlags *flags, unsigned int tag)'

The unpatched output ends:

    case 2:
      flags->second = flags->second == 0;
      return;
    
  }
  flags->last = flags->last == 0;
  return;
}

The fix

  • Join a visited instruction at the inclusive function end before handling the range boundary, preserving the shared return block.
  • Continue decoding an unseen final instruction. Both switch structurers receive the correct graph.

The tests

The bounded native round trip fails without the fix. Controls cover separate default/last returns, duplicate return entries, signed guards and a real post-switch write; both structurers and return-duplication settings run with GCC/Clang at -O0/-O2.

make test (675/675), make test-stages (1909/1909), make rust-test, make check-spec, make test-tools, make lint, and kuna catalog --check pass; no existing expectation moved.

80 interleaved pairs: bounded median CLI time 121.3 → 120.2 ms (-0.9%); unbounded control 119.3 → 120.4 ms (+0.9%).

mgostIH and others added 10 commits October 4, 2026 15:40
Join already visited instructions at the inclusive flow boundary before decoding the final in-range instruction again. This preserves return-only switch entries and out-of-range guards sharing the final RET with the last case.

Add a bounded authored switch stage and native round-trip controls for shared and separate returns, duplicate return entries, signed guards, and a genuine post-switch write. Update the lift/flow specification and stage inventory.
…dress space (Noelo-Lab#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>
…es (Noelo-Lab#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.
…o-Lab#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.
…le caller (Noelo-Lab#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (Noelo-Lab#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (Noelo-Lab#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (Noelo-Lab#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>
…xtents (Noelo-Lab#894)

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (Noelo-Lab#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (Noelo-Lab#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (Noelo-Lab#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (Noelo-Lab#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (Noelo-Lab#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (Noelo-Lab#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (Noelo-Lab#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (Noelo-Lab#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (Noelo-Lab#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in Noelo-Lab#904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of Noelo-Lab#904

* [AUTOMATED] Preserve late-resolved stores across memory effects (Noelo-Lab#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References Noelo-Lab#886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (Noelo-Lab#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (Noelo-Lab#856 in Noelo-Lab#890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (Noelo-Lab#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (Noelo-Lab#858, Noelo-Lab#890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (Noelo-Lab#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes Noelo-Lab#871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (Noelo-Lab#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes Noelo-Lab#861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (Noelo-Lab#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (Noelo-Lab#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in Noelo-Lab#890 (formerly Noelo-Lab#887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (Noelo-Lab#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in Noelo-Lab#890 (formerly Noelo-Lab#856), following Noelo-Lab#908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (Noelo-Lab#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (Noelo-Lab#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (Noelo-Lab#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (Noelo-Lab#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (Noelo-Lab#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (Noelo-Lab#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (Noelo-Lab#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

---------

Co-authored-by: Zion Leonahenahe Basque <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Codex <codex@localhost>
Co-authored-by: wirsbf <[email protected]>
Co-authored-by: phix33 <[email protected]>
…elo-Lab#895)

* [AUTOMATED] fix(p2): preserve ARM CPSR control state and GE flags

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes #861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in #890 (formerly #887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in #890 (formerly #856), following #908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents (#894)

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes #861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in #890 (formerly #887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in #890 (formerly #856), following #908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

---------

Co-authored-by: Zion Leonahenahe Basque <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Codex <codex@localhost>
Co-authored-by: wirsbf <[email protected]>
Co-authored-by: phix33 <[email protected]>

---------

Co-authored-by: Zion Leonahenahe Basque <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Codex <codex@localhost>
Co-authored-by: wirsbf <[email protected]>
Co-authored-by: phix33 <[email protected]>
…-Lab#896)

* [AUTOMATED] fix(p9): guard ARM register-controlled left shifts

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes #861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in #890 (formerly #887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in #890 (formerly #856), following #908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents (#894)

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes #861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in #890 (formerly #887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in #890 (formerly #856), following #908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

---------

Co-authored-by: Zion Leonahenahe Basque <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Codex <codex@localhost>
Co-authored-by: wirsbf <[email protected]>
Co-authored-by: phix33 <[email protected]>

* [AUTOMATED] fix(p2): preserve ARM CPSR control state and GE flags (#895)

* [AUTOMATED] fix(p2): preserve ARM CPSR control state and GE flags

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width po…
…rators (Noelo-Lab#901)

* [AUTOMATED] fix(p9): preserve declared callback signatures in C declarators

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes #861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in #890 (formerly #887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in #890 (formerly #856), following #908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents (#894)

* [AUTOMATED] fix(p2): keep interior entries within asserted function extents

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack aggregates (#912)

## Problem

A callback writing into an ARM struct parameter's stack spill is lost: the function returns the saved field value. On main, this prints the incorrect lines below:

```sh
cat >/tmp/wrapped.c <<'C'
struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};
short readtemp0(struct dev d){if(d.temp)d.temp(&d,&d.t);return d.t;}
C
clang --target=thumbv7em-none-eabi -O0 -c /tmp/wrapped.c -o /tmp/wrapped.o
kuna decompile /tmp/wrapped.o readtemp0 \
  --assert 'typedef struct dev {void (*temp)(struct dev *,short *);int pad[16];short t;};' \
  --assert 'prototype readtemp0 short readtemp0(struct dev d)'
```

```c
(*v1)((dev *)&v1,(short *)&Stack00000034);
return SUB562(v2,0x34);
```

## Fix

- Recover one local struct when its wrapping spill exactly matches a locked register/stack parameter layout; the callback now receives `&v1` and `&v1.t`, and the function returns `v1.t`.
- Preserve its two physical stack pieces through snapshots, retyping, removal, and repeated decompilation.
- Give wrapped locals distinct temporary wire storage because Ghidra cannot represent a stack variable spanning entry SP=0; ordinary JOIN mappings keep their existing encoding.

## Tests

Thumb/ARM big-endian O0/O2 printed-C execution checks callback writes, field pointers, register prefixes, and distinct struct types. Mapping/serialization tests cover snapshots, retyping/removal, mixed mappings, storage identity, and repeated decompilation; stock Ghidra decodes distinct storage. Parity remains 675/675 and 1883/1883; the workspace and other local checks pass. Affected fixtures: −0.9% to +1.3%; O0/O2 coreutils: −1.9% to +1.1%; a pinned 31-pair repeat of O0 cat measured +0.03%.

Fixes #861.

* [AUTOMATED] Fix missing and incomplete variable source comments

Preserve machine homes through simplification and report all register and stack sources for locals and parameters. Add synthetic regressions and source-provenance checks.

* [AUTOMATED] Preserve incoming caller stack addresses in emitted C (#915)

[AUTOMATED] Preserve proven SysV AMD64 incoming caller storage in emitted C.

Use a CFA expression and selective noinline declarations so native and rebuilt functions return the same caller addresses. Existing 675 datatest and 1900 stage assertions remain unchanged; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native GCC/Clang, project, typed-pointer and dynamic-stack checks pass. Matched N11 timing: fmt -0.195%, ls -0.635%, incoming -0.319%.

* [AUTOMATED] Preserve partial global stores before input pointer reads (#909)

[AUTOMATED] Preserve partial global stores before input pointer reads.

Retain actual narrow stores when a witnessed input-derived pointer can observe them before an overwrite. Keep the original store addresses and widths.

Validation: 675/675 datatest and 1900/1900 stage assertions; full Rust, CLI, spec, catalog, lint and tooling checks pass. Native round trips repair all 58 failing observations in the affected set. The 922-function control sweep is unchanged. Matched timing: affected +1.12%, global-load controls +0.51%, whole binary +0.16%.

Addresses the partial-global-store entry in #890 (formerly #887).

* [AUTOMATED] Preserve memory effects and result order for known syscalls (#913)

[AUTOMATED] Preserve saved values, real stores and returned-length ordering across recognized syscalls.

Admit x64 memory effects only in the proved GCC SysV stack domain. Fence saved loads and full result expressions against intervening memory reads for enabled recognized syscall families.

Validation: 675/675 datatest assertions, 1905/1905 stage assertions with five added and none removed, full Rust, CLI, spec, catalog, lint and tooling checks pass. Native Linux pipes, caller-pointer payloads, project exports, five-family result tests and ABI boundary controls pass. The 775-function control sweep is unchanged. Matched full-loader timing: +2.12%, eleven interleaved pairs over all 299 functions.

Addresses the syscall-memory entry in #890 (formerly #856), following #908.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller (#925)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

* [AUTOMATED] fix(analysis): keep distant call sites with their reachable caller

Retain ARM instruction successors and assign references to entries that reach their bodies. Share that ownership with CLI call graphs, including direct callers, indirect-call flags and bounded inventory fallbacks.

Add authored little- and big-endian regressions with callers established by ordinary calls. Both regressions fail before the fix. Focused tests, parity and supporting checks pass; the workspace retains its documented unrelated pointer-type failure.

* fix(sleigh): the staging-window test cannot wrap at the top of the address space (#918)

windowed_load_fill served a request from the 512-byte window when
curaddr0 + size < bufoffset + 512. For a request at the top of the address
space (a sign-extended negative pointer such as 0xffff_ffff_ffff_6818)
curaddr0 + size wraps to a small value, the test passes, and the in-window
offset indexes far past the buffer: decompile-all panicked on libuv 1.x
built for x86-64 at -O2/-O3. Compare the in-window offset instead, which
is the same test without the wrap. Unit test: a read at 0xffff_ffff_ffff_fffe
after a window at 0x1000 panicked before and is now refilled.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] Exclude call argument transport from local variable sources (#927)

Omit parameter source comments and distinguish native value homes from outgoing argument shuffles. Retain write identity and meaningful local uses so late stack heritage can retract temporary reloads without losing genuine definitions.

Validation: make test (675/675), make test-stages (1912/1912), make rust-test (8006 passed), make check-spec, test-cli (277/277), test-tools (42), lint, catalog, counters, and option documentation freshness.

* [AUTOMATED] feat(sleigh): support isolated speculative decoding (#924)

* [AUTOMATED] feat(sleigh): support isolated speculative decoding

Add nested context scopes that preserve write boundaries, tracked registers and cache state, with rollback, explicit commit and probes of saved context. Certify reusable lifts only when their bytes and complete decode context suffice and they commit no context.

Decoder tests and parity, CLI, Ghidra, lint, spec and catalog checks pass. The workspace retains the documented unrelated pointer-type failure.

* [AUTOMATED] fix(sleigh): include read overrides in decode reuse keys

Build and compare reuse keys from the effective context read by translation,
including ContextCache overrides. Compare words without allocating a new key.

Add a regression that switches the same bytes between ARM and Thumb through
read overrides, rejects stale keys and accepts equivalent effective contexts.
Both parity gates and all decoder tests pass. The full workspace retains the
known unrelated pointer-argument C compilation failure.

---------

Co-authored-by: wirsbf <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zion Leonahenahe Basque <[email protected]>

---------

Co-authored-by: Zion Leonahenahe Basque <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Codex <codex@localhost>
Co-authored-by: wirsbf <[email protected]>
Co-authored-by: phix33 <[email protected]>

* [AUTOMATED] fix(p2): preserve ARM CPSR control state and GE flags (#895)

* [AUTOMATED] fix(p2): preserve ARM CPSR control state and GE flags

* [AUTOMATED] fix(ghidra): print the strings Ghidra defines as literals, not as their labels (#897)

In Ghidra mode a string Ghidra had defined printed as its label
(`s_SplitterContainer__create___Regi_1404c4098`, `u_splitterContainer_1404c4070`)
where the stock decompiler prints the literal.

The printer's string-literal arm checks that the address is read-only by
asking the global scope, which kuna answered from its local symbol table.
In Ghidra mode that table is empty and every program fact lives in the
lazy remote scope, so the check said "not read-only" for every string and
the reference fell back to the label. The check now goes through
`Architecture::is_global_read_only`, which asks the remote scope when one
is installed, as upstream's ScopeGhidra::isReadOnly does.

The ghidra-sim oracle can now answer a string's address the way Java
does (a read-only, type-locked character array under its label).


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(analysis): demangle the MSVC names msvc-demangler rejects (#899)

msvc-demangler fails on encodings recent MSVC emits, and kuna then printed
the raw symbol: on qBittorrent 5.2.4's PDB, 536 functions (932 names with
aliases) such as every QStringBuilder `operator+`/`operator%`, which return
a deduced `auto` (`?A_P`).

A `?` name msvc-demangler rejects now falls back to `undname`, a port of
LLVM's MicrosoftDemangle, which reads `auto` returns, `operator<=>`,
`noexcept` function types, address and member-pointer template arguments
and vtordisp thunks. Its name-only output goes through the same reduction,
with LLVM's `dtor`/`ctor` phrasing spelled as msvc-demangler spells it, and
a vtordisp thunk folded into one identifier
(`QDtlsBasePrivate::error_vtordisp_4_0`). Names msvc-demangler accepts are
untouched.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): print C++ namespaces the way Ghidra's decompiler does (#900)

In Ghidra mode kuna printed every C++ name bare: `instance()` where the
native decompiler prints `UIThemeManager::instance()`, and
`ArticleListWidget(...)` for the declaration of
`ArticleListWidget::ArticleListWidget`. Java sends a symbol's bare name plus
its namespace id; kuna resolved the path but never printed it.

- Port `PrintC::pushSymbolScope`/`emitSymbolScope` and
  `Symbol::getResolutionDepth` over namespace name paths
  (p9_emit/kuna_namespaces.rs). Calls carry the scopes the Display
  Namespaces strategy needs from the calling function's namespace (Minimal
  by default), declarations their full path, one token per scope so Java
  renders `::` instead of `__`.
- The collision test that can add a scope asks the host (`isNameUsed`) once
  the function's own locals are ruled out, as `ScopeLocal::isNameUsed` ->
  `ScopeGhidraNamespace::isNameUsed` does upstream.
- The existing global-name qualifier now uses the same resolution rule.
- The ghidra-sim oracle models namespaces (ids per `::` prefix and the
  getNamespacePath answer).

qbittorrent.exe with its PDB, 100 sampled functions in real Ghidra: call
names matching stock exactly 443 -> 710 of 725; the rest are string and
expression differences, not namespaces.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* web(collab): add "Connect across the internet" to live sessions (#902)

Live sessions at `/decompile/` only connected people on one network. The pages used no ICE servers, and the only way to add a STUN server was a `localStorage` key set from the browser console, so two people on different networks got "Could not connect directly. You may need to be on the same network."

The invite dialog now has a box for it:

```
Your name
[ Ana                                  ]
[ ] Connect across the internet  (?)
                          [Make an invite link]
```

Hovering or focusing the **?** says: "For people on other networks. It uses Cloudflare's STUN server, which only tells each browser its internet (IP) address so the two computers can connect. None of your data passes through it: the program and the changes go straight between the browsers. The invite link then includes your IP address."

- The box starts unticked and is remembered in `kuna.d2.collab` as `stun: true`, the key the console setting already used. `stun: true` now means `stun:stun.cloudflare.com:3478` instead of Google's server; a `stun:` URL still picks another, and the TURN setting is unchanged.
- The choice belongs to the session. Its later links and the introductions between members use it. A guest's page answers an invite that carries an internet address with STUN too, so guests need no setting; their join dialog says that joining shares their IP address.
- A failed connection says what to try. In a session on one network, it suggests a new link with the box ticked. In a session across the internet, it suggests trying another network. If STUN finds no address, the invite says the link may work only on that network.
- With the box ticked, making a link waits up to 1.5 s for STUN. Unticked, nothing changes.

Tests: `decompile2-collab.mjs` covers the setting, the session's override and `crossesNetworks`. A new `decompile2-collab-page.mjs` case covers the dialog in Chrome:
- the box starts unticked and its **?** shows the explanation;
- an unticked link uses no STUN server and has no public address;
- a ticked link uses Cloudflare's server, and the choice is remembered;
- a guest in a second browser answers a cross-network invite with STUN while its own setting is off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01N5Te9G1qTpJhPVvS4QMunF

* [AUTOMATED] fix(p6): a Win64 home slot's address prints as the local that holds it (protoranges) (#903)

kuna printed the address of a Win64 home slot as &Stack0000000000000018
beside a separate variable declared at the same slot, so the store and the
call that reads it looked unrelated. Stock Ghidra prints one local:
`code *local_res18 [2]; local_res18[0] = worker_proc; consume(local_res18);`.

kuna never read a prototype's <localrange>, nor took its parameter range
from the <input> stack entries, as upstream ProtoModel::decode does; every
model used the defaults, under which the home area (stack 8..39 in
x86-64-win.cspec) is parameter space and no local is mapped over it. The
model now keeps the spec's ranges beside the defaults and `option
protoranges` (default on, 0/675 datatest assertions moved) selects them.

In Ghidra mode the host's 8-byte local_res18 is a name recommendation;
it now renames the Symbol that starts at its address, as upstream
recoverNameRecommendationsForSymbols does, instead of one 8-byte variable.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(ghidra): apply the call-fixups the host attaches to a callee (#898)

In Ghidra mode on Windows, kuna printed calls to the MSVC helpers stock
Ghidra replaces with the compiler spec's call-fixups: `__chkstk`,
`__security_check_cookie`, the x86 EH/SEH prolog helpers, and the Control
Flow Guard dispatcher, so every guarded virtual call printed as
`_guard_dispatch_icall(v10)` with its real target gone.

Ghidra's Call-Fixup Installer tags these functions and Java sends the tag as
the `<inject>` of the callee's `<prototype>`. The decoder dropped it. It now
resolves the name against the cspec call-fixups (FuncProto::decode's
getPayloadId) and carries the payload id to the flow's queryCall and to the
global entry ActionDeindirect reads; the p-code already came from
getCallFixup. The standalone CLI is unchanged.


Claude-Session: https://claude.ai/code/session_01P5o4staUBV6w6hEVKucuZW

Co-authored-by: Claude Opus 5.5 <[email protected]>

* [AUTOMATED] fix(p9): render partial scalar joins as C arithmetic (#905)

Replace a proven preserved upper prefix and rewritten lower suffix with unsigned masks and OR. Keep the full return value and truncate promoted narrow expressions to their machine width.

The module 5 sweep changed only eight port conversion helpers across 880 functions. Emitted C matched assembly in 2,917,504 comparisons. All four gates, tooling tests, lint, and the catalog check passed.

* [AUTOMATED] Recover one retry loop and emit while (true) (#906)

* [AUTOMATED] fix(p8): preserve early continues in retry loops

* [AUTOMATED] feat(p9): default infinite loops to while (true)

---------

Co-authored-by: Codex <codex@localhost>

* [AUTOMATED] fix(p4): a value returned in two registers came back with its halves swapped on big-endian targets and AVR (option bejoin) (#763)

## The problem

Some big-endian two-register returns print with their halves swapped. For example:

```sh
printf '%s\n' 'long long wide_mul(int a, int b) { return (long long)a * b; }' > wm.c
clang --target=powerpc-linux-gnu -O2 -c wm.c -o wm.o
kuna decompile wm.o wide_mul
```

```c
return CONCAT44(a1 * a0,(int)((unsigned long)((long)a1 * a0) >> 0x20));
```

## The fix

- `kuna decompile wm.o wide_mul --option bejoin on` joins the returned words in ABI order. Selected call-result pairs and AVR register pairs use the same correction.
- `bejoin` is off by default, including in aggressive mode. Its instruction-based heuristic can mistake a genuine 32-bit return for a 64-bit value, so enabling it remains an explicit choice.
- With the option off, output follows main's existing behavior. Known limitations and the evidence needed for a safe default are recorded in #904.

## The tests

Stage and compiled round-trip tests cover big-endian targets, AVR, narrow returns, and little-endian controls. Differential checks compare default output with main and enabled output with the previous implementation.

Part of #904

* [AUTOMATED] Preserve late-resolved stores across memory effects (#907)

## The problem

A store made between two calls disappears when the compiler reloads the global's address from a frame slot. Both calls survive, so the second call observes the wrong value.

```sh
printf 'int gi;void touch(void);int s7(int b){gi=b;touch();gi=9;touch();return 1;}\n' > s7.c
clang --target=aarch64-linux-gnu -O0 -c s7.c -o s7.o
kuna decompile s7.o s7
```

The emitted body contains:

```c
dat_400044 = a0;
touch();
touch();
```

## The fix

- Connect a newly resolved direct store to its existing memory effects immediately, before dead-code removal.
- Preserve unaffected bytes for overlapping ranges in either endianness; leave effects belonging to other operations alone.

## The tests

AArch64 and x86-64 fixtures at `-O0`/`-O2` recompile and execute the printed C with callbacks that observe and change memory. They cover repeated stores, aliasing and distinct pointers, intervening loads, branches, and dead stores. Byte-level tests cover exact, partial, contained, and disjoint effects in both endiannesses. Existing expectations are unchanged; measured speed delta is at most +1.8%.

References #886.

* [AUTOMATED] Preserve memory effects of enabled inline syscalls (#908)

## The problem

An inline system call can overwrite a global buffer, but a later read still uses its pre-call value (#856 in #890).

```sh
cat >/tmp/svc.c <<'C'
int sink;
int rd(int fd, int x) {
  int v = x + 7; sink = v;
  register int r0 asm("r0") = fd, r1 asm("r1") = (int)&sink;
  register int r2 asm("r2") = 4, r7 asm("r7") = 3;
  asm volatile("svc 0" : "+r"(r0) : "r"(r1), "r"(r2), "r"(r7) : "memory");
  return v * 5 + sink;
}
C
clang --target=armv7-linux-gnueabi -O2 -c /tmp/svc.c -o /tmp/svc.o
kuna decompile /tmp/svc.o rd --option syscallregs on
```

```c
  return (a1 + 7) * 6;
```

## The fix

- Give recognized, enabled syscall user ops unknown effects on writable memory during heritage; keep the store before the call and reload afterward.
- Save pointer loads before a syscall instead of moving them across it.
- Reuse `syscallregs`' existing OS-image policy; unrelated user ops and `off` retain their behavior.

## The tests

ARM stage off/on witness; compiled C round trips check kernel-observed stores, changed global buffers, and values saved before one or two calls. Cross-architecture side-effect probes and the full test suite pass. Default whole-loader timing (264 MIPS functions, interleaved min-of-11): −2.2%.

* [AUTOMATED] Preserve writes through spilled stack pointers (#910)

## The problem

At `-O0`, a write through a pointer spilled to the stack can disappear, leaving the return value equal to the array's initializer (#858, #890).

```sh
cat >/tmp/spill.c <<'C'
int h5(int a, int x, int y) {
  int s[2] = {x, y}; int *p = s;
  p[1] = a * 3; return s[1];
}
C
gcc -O0 -fno-stack-protector -c /tmp/spill.c -o /tmp/spill.o
kuna decompile /tmp/spill.o h5 --assert 'prototype h5 int h5(int a, int x, int y)'
```

Current output:
```c
int h5(int a,int x,int y)
{
  return y;
}
```

## The fix

- Preserve stack reads until a spilled store pointer resolves, then retain guards only for proven overlapping stack destinations.
- Restrict the proof to full-width pointers on byte-addressed stacks; unknown aliases keep the existing policy.
- Filter proven targets in closed large frames and bound provisional work elsewhere. Explicit broad alias guarding remains available.

## The tests

Compile and execute printed C from 14 GCC/Clang objects across six architectures, covering changed elements, constants, neighbors, repeated writes, pointer reassignment and call escapes. The repro fails without this fix. Existing 675 datatest and 1,878 stage assertions retain parity; the workspace and spec checks pass. Closed 64–256-store stress runs improved 2.9–7.8%; measured O0/O2 `basename` and `cat` runs show no slowdown.

* [AUTOMATED] Preserve computed global write order (#911)

## The problem

A computed global update can print before an aliasing pointer load, changing a return from 904 to 909. The same merging can hoist case-local volatile stores ahead of a switch and add writes.

```sh
cat >/tmp/globalorder.c <<'C'
int gi=4;
int ew(int *p,int b) { int t=gi*2+b; int x=*p; gi=t; return x+t*100; }
int main(void) { return ew(&gi,1); }
C
gcc -O0 /tmp/globalorder.c -o /tmp/globalorder
kuna decompile /tmp/globalorder ew
```

```c
gi = a1 + gi * 2;
v1 = *a0;
return v1 + gi * 100;
```

## The fix

- Keep computed values separate when merging would move a guarded global write across an observation or onto another path.
- Preserve the delayed copies before forced phi merging; keep existing handling for global-state markers and old global values.
- Apply this strict correction within the existing `indexaliasguard global` default.

## The tests

Five stage assertions, GCC/Clang O0/O2 native roundtrips and actual memory-access traces, a marker-state IR control, and Ghidra store-order assertions. The existing 675 assertions, workspace suite, and spec checks pass; no datatest baseline moved. Eleven alternating timing pairs: fmt −3.1%, ls −3.0%, 600-update stress −0.9%.

Fixes #871.

* [AUTOMATED] Preserve writes to wrapped stack agg…
@mahaloz
mahaloz merged commit c955a71 into Noelo-Lab:main Oct 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants