We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38fd546 commit 09497fbCopy full SHA for 09497fb
lab-1/fib.s
@@ -14,19 +14,29 @@ fibonacci:
14
push {r3, r4, r5, lr}
15
16
@ R4 = R0 - 0 (update flags)
17
+ mov r4, r0
18
@ if(R0 <= 0) goto .L3 (which returns 0)
19
+ cmp r4, #1
20
+ blt .L3
21
22
@ Compare R4 wtih 1
23
@ If R4 == 1 goto .L4 (which returns 1)
24
+ beq .L4
25
26
@ R0 = R4 - 1
27
+ sub r0, r4, #1
28
@ Recursive call to fibonacci with R4 - 1 as parameter
29
+ bl fibonacci
30
31
@ R5 = R0
32
+ mov r5, r0
33
@ R0 = R4 - 2
34
+ sub r0, r4, #2
35
@ Recursive call to fibonacci with R4 - 2 as parameter
36
37
38
@ R0 = R5 + R0 (update flags)
39
+ add r0, r5, r0
40
41
pop {r3, r4, r5, pc} @EPILOG
42
0 commit comments