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 9 to 14 of 22
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
-
-
;
disassembly
sort
4011
9d
12
cmp
eax, [rcx + rdx*4]
4011
a0
setg
al
4011
a3
mov
[rbp - 0xd], al
7fffffffecd3
◂
1
4011
a6
mov
al, [rbp - 0xd]
7fffffffecd3
◂
1
4011
a9
test
al, 1
1
:
1
zf
4011
ab
jne
4011af
taken
· reads zf
4011
ad
jmp
4011e7
4011
af
13
mov
eax, [rbp - 0xc]
4011
b2
sub
eax, 1
4011
b5
cdqe
4011
b7
lea
rdi, [rip + 0x2e52]
×11
×5
×5
registers
stack
heap
code
data
rwx
read-only
rbx
0
r8
7ffff7e19680
r9
7ffff7e1afa0
r10
7fffffffea60
r11
7ffff7ffca90
r12
7fffffffee38
r13
1
r14
7ffff7ffd000
r15
403e10
rax
1
rcx
404010
0x900000004
rdx
4
rsi
404024
0x1f0000001a
rdi
404020
0x1a00000005
rbp
7fffffffece0
7fffffffed00
7fffffffedb0
7fffffffee10
0
rsp
7fffffffecd0
0x401000000
rip
4011ab
sort+91
cf
pf
af
zf
sf
IF
df
of
stack
twenty words from rsp · the frames they belong to
rsp
+0
j, high half
7fffffffe
cd0
0x401000000
+8
i, n
7fffffffe
cd8
0x800000006
rbp
+10
saved rbp
7fffffffe
ce0
7fffffffed00
+18
7fffffffe
ce8
401219
main+25
+20
7fffffffe
cf0
0
+28
7fffffffe
cf8
0
+30
saved rbp
7fffffffe
d00
7fffffffedb0
+38
7fffffffe
d08
7ffff7c27781
libc+27781
+40
7fffffffe
d10
7ffff7fe0c60
ld.so+22c60
+48
7fffffffe
d18
7fffffffee38
+50
7fffffffe
d20
0x1f7fbe000
+58
7fffffffe
d28
401200
main+0
+60
7fffffffe
d30
7fffffffed70
+68
7fffffffe
d38
+70
7fffffffe
d40
0
+78
7fffffffe
d48
0x455b402647827406
+80
7fffffffe
d50
7fffffffee38
+88
7fffffffe
d58
1
+90
7fffffffe
d60
7ffff7ffd000
+98
7fffffffe
d68
403e10
sort
main
libc.so.6+27781
moment 434 of 1905
The sixth pass, its third compare: 17 > 5, so jne takes the swap.
The swap has run 5 times so far, and each loop has turned 5.