Question: 11. [8 points] Fill in the blanks in the assembly code on the right necessary to make it equivalent to the C++ code on the
![11. [8 points] Fill in the blanks in the assembly code](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f46401a2a51_41766f464011a309.jpg)
11. [8 points] Fill in the blanks in the assembly code on the right necessary to make it equivalent to the C++ code on the left and obey the calling convention. It may not be necessary to use all the blanks. Recall that: * the first argument is in RDI, the second argument is in RSI, the return value is in RAX RBX, RBP, and R12-R15 are caller-saved registers countSpaces: mov RBX, RDI// array in RBX mov R8, 0 // i in R8 loop: mov_--- , add RBX R8 int countSpaces (char *array) I nt i - 0 while (isspace (array[i]) -0) call isspace return i; cmp RAX, 0 je endLoop add R8, 1 jmp loop // isspace ) ?- O0 endLoop: mov ,--- ret 11. [8 points] Fill in the blanks in the assembly code on the right necessary to make it equivalent to the C++ code on the left and obey the calling convention. It may not be necessary to use all the blanks. Recall that: * the first argument is in RDI, the second argument is in RSI, the return value is in RAX RBX, RBP, and R12-R15 are caller-saved registers countSpaces: mov RBX, RDI// array in RBX mov R8, 0 // i in R8 loop: mov_--- , add RBX R8 int countSpaces (char *array) I nt i - 0 while (isspace (array[i]) -0) call isspace return i; cmp RAX, 0 je endLoop add R8, 1 jmp loop // isspace ) ?- O0 endLoop: mov ,--- ret
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
