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 =

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 sum (int c, int d) { return c + d } 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) $a0 and $al - return value $v0 stack pointer $sp main: /* write your instructions here */ jal test /* assume your program is terminated here */ test: /* write your instructions here */ jal sum /* write your instructions here */ jr $ra sum: /* write your instructions here */ jr Sra

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions