From 6142fa676731e158622ca7956c150c58bc57f1f2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 10:38:37 -0300 Subject: design: the graph of a function's blocks; two runs as a pair From the user. The disassembly's alternate form at a larger scale is the graph of its basic blocks: a block a box of rows with its offset, lines and visit count; execution flows down and a back edge is the one thing that climbs, in its loop's lane with the turn count; what the run never reached folds away. On the map it takes the disassembly's place; in the working frame a blocks lens draws its shape and the rows are its view. Verbs leave and turn carry the mark along an edge. Two runs of one program share a frame as a pair: the seam is the gutter, the source shared above, rows only one run has and values that differ marked at the seam. The scene it is made for sets a plain build against an ASan one in a stack overflow: the frame beside its shadow bytes, the store beside its check, and the step where they part. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/22-graph-sort.svg | 453 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 453 insertions(+) create mode 100644 design/mock/22-graph-sort.svg (limited to 'design/mock/22-graph-sort.svg') diff --git a/design/mock/22-graph-sort.svg b/design/mock/22-graph-sort.svg new file mode 100644 index 0000000..21d4041 --- /dev/null +++ b/design/mock/22-graph-sort.svg @@ -0,0 +1,453 @@ + + + + + + +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 graph, two columns wide (1024 to 2816), at moment 370 of 465 in sort + + + +disassembly · sort +its blocks · visits so far · the edges the run took + + + + +6 + + + + + + + + +11 + + +5 + + +5 + + +×5 + + +×5 + + + +401143 +lines 9 to 10 +×1 ++0 +9 +push +rbp ++1 +mov +rbp, rsp ++4 +sub +rsp, 0x18 ++8 +mov +[rbp - 0x14], edi ++b +10 +mov +[rbp - 8] + + + + +, 1 ++12 +jmp +4011e1 + + + +40115a +lines 11 to 12 +×6 ++17 +11 +mov +eax, [rbp - 8] ++1a +mov +[rbp - 4], eax ++1d +12 +jmp +4011a2 + + + +401162 +lines 13 to 14 +×5 ++1f +13 +mov +eax, [rbp - 4] ++22 +cdqe + ++24 +lea +rdx, [rax*4] ++2c +lea +rax, [rip + 0x2eaa] ++33 +add +rdx, rax ++36 +mov +eax, [rbp - 4] ++39 +sub +eax, 1 ++3c +cdqe + ++3e +lea +rcx, [rax*4] ++46 +lea +rax, [rip + 0x2e90] ++4d +add +rax, rcx ++50 +mov +rsi, rdx ++53 +mov +rdi, rax ++56 +call +401116 + + +swap ++5b +14 +sub +[rbp - 4] + + + + +, 1 + + + +4011a2 +line 12 +×11 ++5f +12 +cmp +[rbp - 4] + + + + +, 0 ++63 +jle +4011dd + + + +4011a8 +line 12 +×11 ++65 +12 +mov +eax, [rbp - 4] ++68 +sub +eax, 1 ++6b +cdqe + ++6d +lea +rdx, [rax*4] ++75 +lea +rax, [rip + 0x2e61] ++7c +mov +edx, [rdx + rax*1] +404030 +◂ +17 ++7f +mov +eax, [rbp - 4] ++82 +cdqe + ++84 +lea +rcx, [rax*4] + ++8c +lea +rax, [rip + 0x2e4a] + ++93 +mov +eax, [rcx + rax*1] +404034 +◂ +5 + ++96 +cmp +edx, eax +17 + : +5 + +zf + sf + of + + + ++98 +jg +401162 +taken + · reads zf sf of + + + +4011dd +line 10 +×5 ++9a +10 +add +[rbp - 8] + + + + +, 1 + + + +4011e1 +line 10 +×6 ++9e +10 +mov +eax, [rbp - 8] ++a1 +cmp +eax, [rbp - 0x14] ++a4 +jl +40115a + + + +4011ed +line 17 ++aa +17 +nop + ++ab +nop + ++ac +leave + ++ad +ret + + + + -- cgit v1.3