From a72831d5c322078260314c305ddd940e4967947d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 14:17:51 -0300 Subject: design: rings; nothing from after the moment shown From the user. A loop is a ring its blocks sit on, upright, an inner loop a smaller ring touching its parent, a way out leaving along the tangent; layers stay for functions that are trees of branches; the track is withdrawn. A graph shows only what the run has done by the moment shown: counts so far, a block or edge not reached yet drawn quiet, a fold of what is not reached yet that opens when the run arrives (reach, unfold); the rule stands in Forbidden for every block. A pane unrolls from its strip into its whole column and rolls back, so the whole function or the whole stack can be shown for a beat and a far jump is travelled. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/22-graph-sort.svg | 1099 +++++++++++++++++++++++------------------ 1 file changed, 617 insertions(+), 482 deletions(-) (limited to 'design/mock/22-graph-sort.svg') diff --git a/design/mock/22-graph-sort.svg b/design/mock/22-graph-sort.svg index b30ffe4..0c2d5e4 100644 --- a/design/mock/22-graph-sort.svg +++ b/design/mock/22-graph-sort.svg @@ -1,486 +1,621 @@ - + - + +the map: sort's rings over the source, the disassembly linear beside them, at the 11th compare - - -sort.c -lines 1 to 22 of 22 -1 -int -a -[ -8 -] -= -{ -4 -, -9 -, -17 -, -31 -, -12 -, -26 -, -5 -, -20 -} -; -2 -3 -void -swap -( -int -* -x -, -int -* -y -) -{ -4 -int -t -= -* -x -; -5 -* -x -= -* -y -; -6 -* -y -= -t -; -7 -} -8 -9 -void -sort -( -int -n -) -{ -10 -for -( -int -i -= -1 -; -i -< -n -; -i -+ -+ -) -{ -11 -int -j -= -i -; - - -12 -while -( -j -> -0 -& -& -a -[ -j -- -1 -] -> -a -[ -j -] -) -{ - -13 -swap -( -& -a -[ -j -- -1 -] -, -& -a -[ -j -] -) -; - -14 -j -- -- -; -15 -} -16 -} -17 -} -18 -19 -int -main -( -void -) -{ -20 -sort -( -8 -) -; -21 -return -0 -; -22 -} -the map: sort's disassembly as its track, in the second column (1024 to 1904), at the 11th compare + + +the blocks of sort +its blocks · the visits so far · the path · the loops' turns + + + + + + + + + + + + + + + + + + + + + + + + + + +5 + turns +5 + turns + ++12 +×6 + ++1e +×6 + ++24 +×11 + ++5d +×5 + ++97 +×5 + ++99 +×5 + ++2f +×11 + ++56 +×11 + ++5f +swap +×5 + ++0 +×1 + ++a7 + + + +sort.c +lines 1 to 22 of 22 +1 +int +a +[ +8 +] += +{ +4 +, +9 +, +17 +, +31 +, +12 +, +26 +, +5 +, +20 +} +; +2 +3 +void +swap +( +int +* +x +, +int +* +y +) +{ +4 +int +t += +* +x +; +5 +* +x += +* +y +; +6 +* +y += +t +; +7 +} +8 +9 +void +sort +( +int +n +) +{ +10 +for +( +int +i += +1 +; +i +< +n +; +i ++ ++ +) +{ +11 +int +j += +i +; + + +12 +while +( +j +> +0 +& +& +a +[ +j +- +1 +] +> +a +[ +j +] +) +{ + +13 +swap +( +& +a +[ +j +- +1 +] +, +& +a +[ +j +] +) +; + +14 +j +- +- +; +15 +} +16 +} +17 +} +18 +19 +int +main +( +void +) +{ +20 +sort +( +8 +) +; +21 +return +0 +; +22 +} - - -disassembly · sort -its blocks · visits · the edges taken · the loops' turns - - - - - - - - - - - - - - - - - - - - - - - - - - -×5 -×5 - - - -401150 -lines 9 to 10 -×1 -+0 -9 -push -rbp -+1 -mov -rbp, rsp -+4 -sub -rsp, 0x10 -+8 -mov -[rbp - 4], edi -+b -10 -mov -[rbp - 8] - - - - -, 1 - - - -401162 -line 10 -×6 -+12 -10 -mov -eax, [rbp - 8] -+15 -cmp -eax, [rbp - 4] -+18 -jge -4011f7 -taken 0 · not 6 - - - -40116e -line 11 -×6 -+1e -11 -mov -eax, [rbp - 8] -+21 -mov -[rbp - 0xc], eax - - - -401174 -line 12 -×11 -+24 -12 -xor -eax, eax -+26 -cmp -[rbp - 0xc] - - - - -, 0 -+2a -mov -[rbp - 0xd], al -+2d -jle -4011a6 -taken 0 · not 11 - - - -40117f -line 12 -×11 -+2f -12 -mov -eax, [rbp - 0xc] -+32 -sub -eax, 1 -+35 -movsxd -rcx, eax -+38 -lea -rax, [rip + 0x2e81] -+3f -mov -eax, [rax + rcx*4] -+42 -movsxd -rdx, [rbp - 0xc] - - - - - -+46 -lea -rcx, [rip + 0x2e73] -+4d -cmp -eax, [rcx + rdx*4] -+50 -setg -al -+53 -mov -[rbp - 0xd], al - - - -4011a6 -line 12 -×11 - -+56 -12 -mov -al, [rbp - 0xd] -7fffffffecd3 -◂ -1 - -+59 -test -al, 1 -1 - : -1 - -zf - - - -+5b -jne -4011af -taken - · reads zf - - - -4011af -lines 12 to 14 -×5 -+5f -13 -mov -eax, [rbp - 0xc] -+62 -sub -eax, 1 -+65 -cdqe - -+67 -lea -rdi, [rip + 0x2e52] -+6e -shl -rax, 2 -+72 -add -rdi, rax -+75 -movsxd -rax, [rbp - 0xc] - - - - - -+79 -lea -rsi, [rip + 0x2e40] -+80 -shl -rax, 2 -+84 -add -rsi, rax -+87 -call -401120 - - -swap -+8c -14 -mov -eax, [rbp - 0xc] -+8f -add -eax, 0xffffffff -+92 -mov -[rbp - 0xc], eax -+95 -12 -jmp -401174 - - - -4011ad -line 12 -×5 -+5d -12 -jmp -4011e7 - - - -4011e7 -line 16 -×5 -+97 -16 -jmp -4011e9 - - - -4011e9 -line 10 -×5 -+99 -10 -mov -eax, [rbp - 8] -+9c -add -eax, 1 -+9f -mov -[rbp - 8], eax -+a2 -jmp -401162 - - - -4011f7 -line 17 -+a7 -17 -add -rsp, 0x10 -+ab -pop -rbp -+ac -ret - - - - -the map's stage ends at 1784 + + +disassembly +sort + +401 +13b +mov +rax, [rbp - 8] +swap +401 +13f +mov +[rax], ecx +401 +141 +mov +ecx, [rbp - 0x14] +401 +144 +mov +rax, [rbp - 0x10] +401 +148 +mov +[rax], ecx +401 +14a +pop +rbp +401 +14b +ret + +401 +14c +nop +[rax] +401 +150 +9 +push +rbp +401 +151 +mov +rbp, rsp +401 +154 +sub +rsp, 0x10 +401 +158 +mov +[rbp - 4], edi +401 +15b +10 +mov +[rbp - 8] + + + + +, 1 +401 +162 +mov +eax, [rbp - 8] +401 +165 +cmp +eax, [rbp - 4] +401 +168 +jge +4011f7 +401 +16e +11 +mov +eax, [rbp - 8] +401 +171 +mov +[rbp - 0xc], eax +401 +174 +12 +xor +eax, eax +401 +176 +cmp +[rbp - 0xc] + + + + +, 0 +401 +17a +mov +[rbp - 0xd], al +401 +17d +jle +4011a6 +401 +17f +mov +eax, [rbp - 0xc] +401 +182 +sub +eax, 1 +401 +185 +movsxd +rcx, eax +401 +188 +lea +rax, [rip + 0x2e81] +401 +18f +mov +eax, [rax + rcx*4] +401 +192 +movsxd +rdx, [rbp - 0xc] + + + + + +401 +196 +lea +rcx, [rip + 0x2e73] +401 +19d +cmp +eax, [rcx + rdx*4] +401 +1a0 +setg +al + +401 +1a3 +mov +[rbp - 0xd], al +7fffffffecd3 +◂ +1 + +401 +1a6 +mov +al, [rbp - 0xd] +7fffffffecd3 +◂ +1 + +401 +1a9 +test +al, 1 +1 + : +1 + +zf + + + +401 +1ab +jne +4011af +taken + · reads zf +401 +1ad +jmp +4011e7 +401 +1af +13 +mov +eax, [rbp - 0xc] +401 +1b2 +sub +eax, 1 +401 +1b5 +cdqe + +401 +1b7 +lea +rdi, [rip + 0x2e52] +401 +1be +shl +rax, 2 +401 +1c2 +add +rdi, rax +401 +1c5 +movsxd +rax, [rbp - 0xc] + + + + + +401 +1c9 +lea +rsi, [rip + 0x2e40] +401 +1d0 +shl +rax, 2 +401 +1d4 +add +rsi, rax +401 +1d7 +call +401120 +swap +401 +1dc +14 +mov +eax, [rbp - 0xc] +401 +1df +add +eax, 0xffffffff +401 +1e2 +mov +[rbp - 0xc], eax +401 +1e5 +12 +jmp +401174 +401 +1e7 +16 +jmp +4011e9 +401 +1e9 +10 +mov +eax, [rbp - 8] +401 +1ec +add +eax, 1 +401 +1ef +mov +[rbp - 8], eax +401 +1f2 +jmp +401162 +401 +1f7 +17 +add +rsp, 0x10 +401 +1fb +pop +rbp +401 +1fc +ret + +401 +1fd +nop +[rax] + +401 +200 +push +rbp +main +401 +201 +mov +rbp, rsp +401 +204 +sub +rsp, 0x10 +401 +208 +mov +[rbp - 4] + + + + +, 0 +401 +20f +mov +edi, 8 +401 +214 +call +401150 +sort +401 +219 +xor +eax, eax +401 +21b +add +rsp, 0x10 +401 +21f +pop +rbp + +×1 + +×6 + +×6 + +×11 + +×11 + +×11 + +×5 + +×5 + +×5 + +×5 + + + + + + + + + + + + + + +the map's stage ends at 1784; the other columns (memory, the registers whole, the stack) as in 19 -- cgit v1.3