-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHW7sol.txt
74 lines (62 loc) · 1.17 KB
/
HW7sol.txt
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
(! fib-code
'(fib_setup
main
(irmovl 8192 %esp)
(irmovl 8192 %ebp)
(irmovl 31 %edx) ; %edx <- 31 -- This is < x >
(pushl %edx)
(call fib2)
(halt)
fib_rec
(pushl %ebx)
(mrmovl 16(%esp) %edx)
(mrmovl 8(%esp) %ecx)
(mrmovl 12(%esp) %ebx)
(andl %edx %edx)
(rrmovl %ecx %eax)
(jne L6)
(jmp L2)
L5
(rrmovl %ecx %ebx)
(rrmovl %eax %ecx)
L6
(irmovl 1 %edi)
(pushl %ebx)
(addl %ecx %ebx)
(rrmovl %ebx %eax)
(popl %ebx)
(subl %edi %edx)
(jne L5)
L2
(popl %ebx)
(ret)
fib2
(irmovl 12 %edi)
(subl %edi %esp)
(mrmovl 16 (%esp) %eax)
(xorl %edi %edi)
(subl %edi %eax)
(jl L10)
(irmovl 1 %edi)
(pushl %eax)
(subl %edi %eax)
(popl %eax)
(jle L9)
(subl %edi %eax)
(rmmovl %eax 8(%esp))
(xorl %edi %edi )
(rmmovl %edi 4(%esp))
(irmovl 1 %edi)
(rmmovl %edi 0 (%esp))
(call fib_rec)
L9
(irmovl 12 %edi)
(addl %edi %esp)
(ret)
L10
(xorl %eax %eax)
(irmovl 12 %edi)
(addl %edi %esp)
(ret)
))
fib2(48) is the location where it does not work