list.c lines 19 to 26 of 42 19 struct node * prev = NULL ; 20 while ( head ) { 21 struct node * next = head - > next ; 22 head - > next = prev ; 23 prev = head ; 24 head = next ; 25 } 26 return prev ; disassembly reverse 10019 10 20 test rdi, rdi 10019 13 je 1001935 10019 15 push rbp 10019 16 mov rbp, rsp 10019 19 xor eax, eax 10019 1b nop [rax + rax] 10019 20 mov rcx, rax 10019 23 mov rax, rdi 10019 26 21 mov rdi, [rdi + 8] 1004098 1004070 9 10019 2a 22 mov [rax + 8], rcx 10019 2e 20 test rdi, rdi 10019 31 jne 1001920 10019 33 pop rbp 10019 34 26 ret 10019 35 xor eax, eax 10019 37 ret 10019 38 endbr64 _init registers stack heap code data rwx read-only rax 1004090 4 rbx 0 rcx 10040b0 1 rdx 0 rsi 10040c0 0 rdi 1004070 9 rbp 7fffffffece0 7fffffffed00 7fffffffedb0 7fffffffee10 0 rsp 7fffffffece0 7fffffffed00 7fffffffedb0 7fffffffee10 0 r8 7ffff7e19ac0 r9 0x20 32 r10 0x10 16 r11 7ffff7e19ac8 r12 7fffffffee38 7fffffffefea "./list" r13 1 r14 7ffff7ffd000 7ffff7ffe3c0 0 r15 10029c0 1 rip 1001926 reverse+22 cf PF af zf sf IF df of stack eight words from rsp ยท the frames they belong to rbp rsp +0 saved rbp 7fffffffe ce0 7fffffffed00 +8 7fffffffe ce8 10018b0 main+80 +10 7fffffffe cf0 7ffff7e20de8 +18 saved rbx 7fffffffe cf8 0 +20 saved rbp 7fffffffe d00 7fffffffedb0 +28 7fffffffe d08 7ffff7c27781 libc+27781 +30 7fffffffe d10 7ffff7fe0c60 ld.so+22c60 +38 7fffffffe d18 7fffffffee38 reverse main libc+27781 its bytes the heap, 1004070 to 10040bf 10040 70 09 00 00 00 00 00 00 00 9 50 40 00 01 00 00 00 00 1004050 10040 80 00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 malloc's: a chunk of 32 10040 90 04 00 00 00 00 00 00 00 4 70 40 00 01 00 00 00 00 1004070 10040 a0 00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 malloc's: a chunk of 32 10040 b0 01 00 00 00 00 00 00 00 1 00 00 00 00 00 00 00 00 NULL the list 10040b0 1 rcx 1004090 4 rax 1004070 9 rdi 1004050 16 1004030 25 1004010 36 moment 3 of 4 The load read the word at 1004098: the address of the next node. rdi holds it now, and points at the node whose value is 9.