Question: int Dif ( int a , int b ) { return b - a; } int Sum ( int m , int n ) {

int Dif(int a, int b){
return b - a; }
int Sum(int m, int n){
int p = Dif(n+1, m-1);
int q = Dif(m+1, n-1); return p + q; }
int main(){
int x, y;
z = x + y + Sum(x, y);
return 0; }
Registers Variables
X19 x
X20 y
X21 z
Ex: If the values of X19 and X20 are initialized in the simulator as:
the result is stored in X21:
Registers Data
X195
X2010
the result is stored in X21:
Registers Data
X195
X2010
X2111
Given code:
ADDI X28, XZR, #1000// Assume Stack memory starts at 1000. Do not modify.
// Procedure Main (Do not modify)
Main:
ADD X0, XZR, X19
ADD X1, XZR, X20
BL Sum
ADD X21, X20, X19
ADD X21, X21, X2
B End
// Procedure Sum
Sum:
// Type your code here.
// Procedure Dif (Do not modify)
Dif:
SUB X2, X1, X0
BR X30
End:
The examples were given in the picture.
int Dif ( int a , int b ) { return b - a; } int

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 Programming Questions!