Question: This program asks the user for a string named string and two characters (one for original and one for new). It then replaces each instance

 This program asks the user for a string named string and

This program asks the user for a string named string and two characters (one for original and one for new). It then replaces each instance of the character original found in string with the character new. It outputs the resulting string and the number of substitutions that were made. For example, if string was "sassy" original was 's and new was'p' the program would output the resulting string of "pappy" and 3 as the number of substitutions A MIPS assembly file substitute.s in assignment2 directory contains the code to get the string and two characters for you. It then contains the commented-out C code to do the real work. You should translate the C code to MIPS and add syscalls to output the results. I suggest that you do it in two steps, just like we have been practicing. Create substitute C code that uses labels and goto's. Dont try to write the MIPS code directly! try not to take shortcuts. Make a dumb translation that works first, even if its longer. Then do some optimizations if you like. (Actually, the use of an index is silly here. Can you get rid of the Hint:The program contains suggestions about placing certain variables in certain registers prior to the C section. If you follow this, it will be much easier to use this program in a later exercise set. When you need other registers, use t-registers like Sto

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!