Write a C program using a loop , that will print \"January has had crazy weather
ID: 3663840 • Letter: W
Question
Write a C program using a loop , that will print "January has had crazy weather in Chicago this year" 25 times.
Compile the code for use with a debugger and have the compiler save the assembly code for your program.
Open the assembly file produced and determine the number of assembly instructions that are in the program.
Use gdb to do the following:
set a breakpoint at the printing of the string
step through several iterations of the loop and check the contents of the registers
determine where the index variable from your loop (the variable that is incremented [or decremented] each iteration and is used to know when to terminate the loop) is stored
While doing the above steps, try to come up with the answers to the following questions. Add comments at the top of your C program with your answers.
What is the number of assembly instructions required to execute your program?
Where is the index variable from your loop accessed in the assembly program?
Where is the string "January has had crazy weather in Chicago this year" stored in the assembly program?
Detail the contents of the registers after the 14th iteration.
Explanation / Answer
C: #include int main() { int i; for(i=1;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.