Question: Please translate following code: 2. Please translate following C++ code: int v = 0, w = 1, x = 2, y = 3, z =

 Please translate following code: 2. Please translate following C++ code: int

Please translate following code:

v = 0, w = 1, x = 2, y = 3,

z = 5; int main(void) { w = z; v = w

2. Please translate following C++ code:

int v = 0, w = 1, x = 2, y = 3, z = 5;

int main(void)

{ w = z;

v = w + x;

y = w - x;

z = z -1; }

The compiler decides:

v$s0

w$s1

x$s2

y$s3

z$s4

___________________________________________________

.data

.text

+ x; y = w - x; z = z -1; }

___________________________________________________

Table: System services. value of $v0 System Call Code Arguments Service Result 1 $a0 = integer 2 $f12 = float print_int print_float print_double print_string 3 $f12 = double 4. $a0 = string read_int 5 integer (in $v0) read_float 6 float (in $fo) 7 read_double read_string 8 double (in $80) $a0 = buffer, $al = length $al = amount address in $v0) sbrk 9 exit 10 print_character 11 $a0 = character read_character 12 character (in $v0) open 13 $a0 = filename, file descriptor (in $vo) $al = flags, $a2 = mode $a0 = file descriptor, read 14 bytes read (in $v0) $a1 = buffer, $a2 = count write 15 $a0 = file descriptor, bytes written (in $vo) $a1 = buffer, $a 2 = count close 16 $a0 = file descriptor 0 (in $v0) exit2 17 $a0 = value . data str: asciiz " please input an integer " #save string in memory .text #$s0=9 # print $50 move $a0,$s0 syscall li $v0,4 #print string " please input an integer " #input an integer to $51 syscall li $v0,1 li $v0,5 la $a0,str move $s1,$v0 move $a0,$s syscall li $80,9 li $v0,4 main: addi $s0,$0,0 #v = 0; v + $50 #w=1; w> $s1 # x = 2; x->$s2 # y = 3; y $s3 #z= 4; 2= $54 #w = z; #v = W + X; # y = W - X; # z = Z -1; addi $s3, $0,3 addi $84, $84,-1 sub $s3,$s1,$s2 add $50, $81,$s2 add $s3, $0,3 li $s4, 4 li $82,2 addi $s1, $0,1 move $s 1, $54

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!