Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+ How well do you think you could do your job?

Answered: 1 week ago