Question: Step 2. Using the C Programming language, write four version of a function that contain a loop. Each function should accept two numbers and calculate

Step 2. Using the C Programming language, write four version of a function that contain a loop. Each function should accept two numbers and calculate the sum of all numbers between the first number and last number (inclusive of the first and last number). Tip: Try to use the same number of variables and almost the same logic when writing the C code for all four functions. Once each function is written and tested for correct output, generate an assembly language version of the function using the command: $gcc -O1 -S filename.c. (where filename.c is the C program containing the function). Next,

analyze a. Write a version of the function using a for loop

and compare the assembly language version of each function. [50 marks]

  1. Write a version of the function using a while loop

  2. Write a version of the function using a do..while loop

  3. Write a version of the function using a goto loop

  4. Is the assembly language version of each loop function the same or different? If different, identify the differences. Your comparison should be based on:

    • Number of registers used

    • Number of jumps (iterations)

    • Total number of operations

JUST ANSWER PART E PLEASE!

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!