/
phase6
89 lines (88 loc) · 4.62 KB
/
phase6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Looking at the assembly code, we see <read_six_numbers>, which tells us our input should probably be 6 numbers
=> 0x00000000004010d1 <+0>: push %r14
0x00000000004010d3 <+2>: push %r13
0x00000000004010d5 <+4>: push %r12
0x00000000004010d7 <+6>: push %rbp
0x00000000004010d8 <+7>: push %rbx
0x00000000004010d9 <+8>: sub $0x50,%rsp //makes stack frame
0x00000000004010dd <+12>: lea 0x30(%rsp),%r13
0x00000000004010e2 <+17>: mov %r13,%rsi
0x00000000004010e5 <+20>: callq 0x4015aa <read_six_numbers>
0x00000000004010ea <+25>: mov %r13,%r14 r14 = 1
0x00000000004010ed <+28>: mov $0x0,%r12d //r1d = 0
0x00000000004010f3 <+34>: mov %r13,%rbp
0x00000000004010f6 <+37>: mov 0x0(%r13),%eax
0x00000000004010fa <+41>: sub $0x1,%eax
0x00000000004010fd <+44>: cmp $0x5,%eax
0x0000000000401100 <+47>: jbe 0x401107 <phase_6+54>
0x0000000000401102 <+49>: callq 0x401574 <explode_bomb>
0x0000000000401107 <+54>: add $0x1,%r12d
0x000000000040110b <+58>: cmp $0x6,%r12d
0x000000000040110f <+62>: je 0x401133 <phase_6+98>
0x0000000000401111 <+64>: mov %r12d,%ebx
0x0000000000401114 <+67>: movslq %ebx,%rax
0x0000000000401117 <+70>: mov 0x30(%rsp,%rax,4),%eax
0x000000000040111b <+74>: cmp %eax,0x0(%rbp)
0x000000000040111e <+77>: jne 0x401125 <phase_6+84>
0x0000000000401120 <+79>: callq 0x401574 <explode_bomb>
0x0000000000401125 <+84>: add $0x1,%ebx
0x0000000000401128 <+87>: cmp $0x5,%ebx
0x000000000040112b <+90>: jle 0x401114 <phase_6+67>
0x000000000040112d <+92>: add $0x4,%r13
0x0000000000401131 <+96>: jmp 0x4010f3 <phase_6+34>
0x0000000000401133 <+98>: lea 0x48(%rsp),%rsi
0x0000000000401138 <+103>: mov %r14,%rax
0x000000000040113b <+106>: mov $0x7,%ecx
0x0000000000401140 <+111>: mov %ecx,%edx
0x0000000000401142 <+113>: sub (%rax),%edx
0x0000000000401144 <+115>: mov %edx,(%rax)
0x0000000000401146 <+117>: add $0x4,%rax
0x000000000040114a <+121>: cmp %rsi,%rax
0x000000000040114d <+124>: jne 0x401140 <phase_6+111>
0x000000000040114f <+126>: mov $0x0,%esi
0x0000000000401154 <+131>: jmp 0x401176 <phase_6+165>
0x0000000000401156 <+133>: mov 0x8(%rdx),%rdx
0x000000000040115a <+137>: add $0x1,%eax
0x000000000040115d <+140>: cmp %ecx,%eax
0x000000000040115f <+142>: jne 0x401156 <phase_6+133>
0x0000000000401161 <+144>: jmp 0x401168 <phase_6+151>
0x0000000000401163 <+146>: mov $0x6042f0,%edx
0x0000000000401168 <+151>: mov %rdx,(%rsp,%rsi,2)
0x000000000040116c <+155>: add $0x4,%rsi
0x0000000000401170 <+159>: cmp $0x18,%rsi
0x0000000000401174 <+163>: je 0x40118b <phase_6+186>
0x0000000000401176 <+165>: mov 0x30(%rsp,%rsi,1),%ecx
0x000000000040117a <+169>: cmp $0x1,%ecx
0x000000000040117d <+172>: jle 0x401163 <phase_6+146>
0x000000000040117f <+174>: mov $0x1,%eax
0x0000000000401184 <+179>: mov $0x6042f0,%edx
0x0000000000401189 <+184>: jmp 0x401156 <phase_6+133>
0x000000000040118b <+186>: mov (%rsp),%rbx
0x000000000040118f <+190>: lea 0x8(%rsp),%rax
0x0000000000401194 <+195>: lea 0x30(%rsp),%rsi
0x0000000000401199 <+200>: mov %rbx,%rcx
0x000000000040119c <+203>: mov (%rax),%rdx
0x000000000040119f <+206>: mov %rdx,0x8(%rcx)
0x00000000004011a3 <+210>: add $0x8,%rax
0x00000000004011a7 <+214>: cmp %rsi,%rax
0x00000000004011aa <+217>: je 0x4011b1 <phase_6+224>
0x00000000004011ac <+219>: mov %rdx,%rcx
0x00000000004011af <+222>: jmp 0x40119c <phase_6+203>
0x00000000004011b1 <+224>: movq $0x0,0x8(%rdx)
0x00000000004011b9 <+232>: mov $0x5,%ebp
0x00000000004011be <+237>: mov 0x8(%rbx),%rax
0x00000000004011c2 <+241>: mov (%rax),%eax
0x00000000004011c4 <+243>: cmp %eax,(%rbx)
0x00000000004011c6 <+245>: jge 0x4011cd <phase_6+252>
0x00000000004011c8 <+247>: callq 0x401574 <explode_bomb>
0x00000000004011cd <+252>: mov 0x8(%rbx),%rbx
0x00000000004011d1 <+256>: sub $0x1,%ebp
0x00000000004011d4 <+259>: jne 0x4011be <phase_6+237>
0x00000000004011d6 <+261>: add $0x50,%rsp
0x00000000004011da <+265>: pop %rbx
0x00000000004011db <+266>: pop %rbp
0x00000000004011dc <+267>: pop %r12
0x00000000004011de <+269>: pop %r13
0x00000000004011e0 <+271>: pop %r14
0x00000000004011e2 <+273>: retq
End of assembler dump.