Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (30 points) Assume the following C code. int main() { test (1, 3); } int test (int a int b) int i = sum

image text in transcribed

4. (30 points) Assume the following C code. int main() { test (1, 3); } int test (int a int b) int i = sum (a+1, 6-1) return i + a + b; } int (int , int d) { returns } Complete assembly code for main(), test(), and sum() functions. Try to use a minimum number of instructions. Note, you will need to use stacks to complete the function calls. Please make sure that which registers' values need to be stored in the stack. Register allocations arguments (a, b, c, and d) return value stack pointer $a and sal $v0 $sp main: / - write your instructions here */ jal test / - assume your program is terminated here - / test: / - write your instructions here -/ jal SU / - write your instructions here */ jr sum: / - write your instructions here */ js

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

Recommended Textbook for

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago