Escolar Documentos
Profissional Documentos
Cultura Documentos
CMPT 295
2.
3.a)
N:15, Value:6
N:14, Value:6
N:13, Value:6
N:12, Value:5
N:11, Value:4
N:10, Value:4
N:9, Value:4
N:8, Value:4
N:7, Value:3
N:6, Value:2
N:5, Value:2
N:4, Value:2
N:3, Value:2
N:2, Value:1
N:1, Value:0
N:0, Value:0
3b) Given a sentence, tell me how many letter o’s there are.
3c) Purpose of %rcx is see which character to compare with character with the 0x6f (“o”) .
3d) Goes backwards through str. The loop will repeat itself only if the value in %rcx is less than %rdi
meaning that %rcx should be the number of characters to read starting from the beginning of %rdi.
Within the loop: the call to decq rcx is made leading to the conclusion that the str is being read
backwards.
4)
Mul.s
.globl times
times:
mov $0,%eax
#return to loop
loop:
jl endloop
add %edi,%eax
dec %esi
jmp loop
endloop:
ret