Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The MIPS assembly below computes the gcd of a given input x and y. The input x is passed through register $a0, and the input

The MIPS assembly below computes the gcd of a given input x and y. The input x is passed through register $a0, and the input y is passed through register $a1, the result is returned in register $v0, and the initial caller is main. In the assembly code, we assume that the initial value of x is 5, and the initial value of y is 2, the current value of stack pointer is 0x3000, and $v0 is zero. Then, Please fill the blanks in the below table.

image text in transcribed

image text in transcribed

image text in transcribed

Please write clearly !! thank you

C code int gcd(int x int y)i if (x-y) return x: else ifxy) return gcdG-, ); else return gcd(x y-x); Assembly Code Memory Address 0x4000 0x4004 0x4008 0x400C Ox4010 Ox4014 0x4018 0x401C 0x4020 0x4024 0x4028 Ox402C 0x4030 0x4034 0x4038 0x403C 0x4038 0x2000 0x2004 gcd: addi $sp, $sp.-12 sw ra, 8($sp) sw a0, 4(Ssp) sw al, 0(Ssp) slt $t0, $al, $a0 bne StO, $zero, L1 subu $al, al, $a0 jal gcd LI: subu $a0.Sa0.$al jal gcd L2: move $V0, $a0 addi $sp, $sp. 12 r ra main: jal gcd

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_2

Step: 3

blur-text-image_3

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago