/* c18 probe 3, row wc2017b1 -- THE SAME QUESTION AS probe_calls.cpp, WITH THE DEAD-STORE
TRAP FIXED. probe_calls.cpp's ledger was a never-read `static` array and gcc-9
deleted its stores, so `mem_kb` came back unchanged and the probe measured nothing
(GOAL.md:75-78 -- the same trap that once made "1 store = free" look true).
THE FIX, AND IT IS THE RULE A SUCCESSOR SHOULD COPY: THE BUFFER IS `volatile`, so
every write is a side effect the compiler may not remove. Nothing else changes.
WHAT IT MEASURES: 16 pages (64 KB) written per call, so
mem_kb = (the harness's 4n array) + 4*(16*calls + 1)
and the CALL COUNT of the case that the board reports reads directly out of mem_kb.
A correct-looking number of calls on a freshly generated array means agg1's AC at
the no-op's own time (705.987 ms) has no data-side explanation left; more calls than
cases, or a sorted array on entry, would name it.
Deliberately degenerate (it does not sort): WA, permitted by GOAL.md:36. */
static volatile unsigned char g_ledger[1 << 18];
void sort(unsigned *a, int n) {
static unsigned long off = 0;
if (off + 4096 * 16 > sizeof g_ledger) return;
for (int p = 0; p < 16; p++) g_ledger[off + 4096 * p] = (unsigned char)(n >> 24);
off += 4096 * 16;
}