the map: sort's rings over the source, the disassembly linear beside them, 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
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