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