Question: So I'm working on the classic binary lab and I think I've managed to figure it out yet for some reason my solution does not
So I'm working on the classic binary lab and I think I've managed to figure it out yet for some reason my solution does not work. So there is a linked_list of 6 nodes and my answer is a string of 6 integers separated by a space. Numbers can only range from 1 to 6. From what I understood, it all boils down to sorting my list in descending order of node values and the answer is the order of nodes. for most people the sequence is either in ascending or descending order but I can't seem to figure it out with this one. So I guess what I need help with is determining what order the bomb is looking for as output.
In my case, this happens to be:

here is also the dump if you want to take a look at it. Thanks
Dump of assembler code for function phase_6:
=> 0x00000000004010df : push %r14
0x00000000004010e1 : push %r13
0x00000000004010e3 : push %r12
0x00000000004010e5 : push %rbp
0x00000000004010e6 : push %rbx
0x00000000004010e7 : sub $0x50,%rsp
0x00000000004010eb : lea 0x30(%rsp),%r13
0x00000000004010f0 : mov %r13,%rsi
0x00000000004010f3 : callq 0x4015aa
0x00000000004010f8 : mov %r13,%r14
0x00000000004010fb : mov $0x0,%r12d
0x0000000000401101 : mov %r13,%rbp
0x0000000000401104 : mov 0x0(%r13),%eax
0x0000000000401108 : sub $0x1,%eax
0x000000000040110b : cmp $0x5,%eax
0x000000000040110e : jbe 0x401115
0x0000000000401110 : callq 0x401574
0x0000000000401115 : add $0x1,%r12d
0x0000000000401119 : cmp $0x6,%r12d
0x000000000040111d : je 0x401141
0x000000000040111f : mov %r12d,%ebx
0x0000000000401122 : movslq %ebx,%rax
0x0000000000401125 : mov 0x30(%rsp,%rax,4),%eax
0x0000000000401129 : cmp %eax,0x0(%rbp)
0x000000000040112c : jne 0x401133
0x000000000040112e : callq 0x401574
0x0000000000401133 : add $0x1,%ebx
0x0000000000401136 : cmp $0x5,%ebx
0x0000000000401139 : jle 0x401122
0x000000000040113b : add $0x4,%r13
0x000000000040113f : jmp 0x401101
0x0000000000401141 : lea 0x48(%rsp),%rsi
0x0000000000401146 : mov %r14,%rax
0x0000000000401149 : mov $0x7,%ecx
0x000000000040114e : mov %ecx,%edx
0x0000000000401150 : sub (%rax),%edx
0x0000000000401152 : mov %edx,(%rax)
0x0000000000401154 : add $0x4,%rax
0x0000000000401158 : cmp %rsi,%rax
0x000000000040115b : jne 0x40114e
0x000000000040115d : mov $0x0,%esi
0x0000000000401162 : jmp 0x401184
0x0000000000401164 : mov 0x8(%rdx),%rdx
0x0000000000401168 : add $0x1,%eax
0x000000000040116b : cmp %ecx,%eax
0x000000000040116d : jne 0x401164
0x000000000040116f : jmp 0x401176
0x0000000000401171 : mov $0x6042f0,%edx
0x0000000000401176 : mov %rdx,(%rsp,%rsi,2)
0x000000000040117a : add $0x4,%rsi
0x000000000040117e : cmp $0x18,%rsi
0x0000000000401182 : je 0x401199
0x0000000000401184 : mov 0x30(%rsp,%rsi,1),%ecx
0x0000000000401188 : cmp $0x1,%ecx
0x000000000040118b : jle 0x401171
0x000000000040118d : mov $0x1,%eax
0x0000000000401192 : mov $0x6042f0,%edx
0x0000000000401197 : jmp 0x401164
0x0000000000401199 : mov (%rsp),%rbx
0x000000000040119d : lea 0x8(%rsp),%rax
0x00000000004011a2 : lea 0x30(%rsp),%rsi
---Type to continue, or q to quit---
0x00000000004011a7 : mov %rbx,%rcx
0x00000000004011aa : mov (%rax),%rdx
0x00000000004011ad : mov %rdx,0x8(%rcx)
0x00000000004011b1 : add $0x8,%rax
0x00000000004011b5 : cmp %rsi,%rax
0x00000000004011b8 : je 0x4011bf
0x00000000004011ba : mov %rdx,%rcx
0x00000000004011bd : jmp 0x4011aa
0x00000000004011bf : movq $0x0,0x8(%rdx)
0x00000000004011c7 : mov $0x5,%ebp
0x00000000004011cc : mov 0x8(%rbx),%rax
0x00000000004011d0 : mov (%rax),%eax
0x00000000004011d2 : cmp %eax,(%rbx)
0x00000000004011d4 : jge 0x4011db
0x00000000004011d6 : callq 0x401574
0x00000000004011db : mov 0x8(%rbx),%rbx
0x00000000004011df : sub $0x1,%ebp
0x00000000004011e2 : jne 0x4011cc
0x00000000004011e4 : add $0x50,%rsp
0x00000000004011e8 : pop %rbx
0x00000000004011e9 : pop %rbp
0x00000000004011ea : pop %r12
0x00000000004011ec : pop %r13
0x00000000004011ee : pop %r14
0x00000000004011f0 : retq
End of assembler dump.
(gdb) x /4x $rbx 0x6042f0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
