# Question & Answer: ase exactly as they would appear. Translate the following C code into assembly co…..

Help numb 6

What is accomplished by the overall function? Be Specific! After the function call, what is the value of “Q”? Write out the contents of phrase exactly as they would appear. Translate the following C code into assembly code. Do NOT write your own strlen() function, just call it correctly. char phrase [] = “Almost DONE!”}//assume that “phrase” is already initialized int x = strlen(phrase), y = 0;//while (y

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: ase exactly as they would appear. Translate the following C code into assembly co…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

6)

char phrase[] = “Almost DONE!”;

int x = strlen(phrase), y=0;

while(y<x) {

if(phrase[y] == ‘0’) break;

y++;

}

return y;

———————————————————————————————————–

sample():

sw \$31,52(\$sp)

sw \$fp,48(\$sp)

move \$fp,\$sp

lui \$2,%hi(\$LC0)

lw \$5,%lo(\$LC0)(\$2)

lw \$4,4(\$3)

lw \$3,8(\$3)

sw \$5,32(\$fp)

sw \$4,36(\$fp)

sw \$3,40(\$fp)

lbu \$2,12(\$2)

nop

sb \$2,44(\$fp)

move \$4,\$2

jal strlen

nop

sw \$2,28(\$fp)

sw \$0,24(\$fp)

lw \$3,24(\$fp)

lw \$2,28(\$fp)

nop

slt \$2,\$3,\$2

beq \$2,\$0,\$L2

nop

lw \$2,24(\$fp)

lb \$3,8(\$2)

li \$2,48 # 0x30

beq \$3,\$2,\$L6

nop

lw \$2,24(\$fp)

nop

sw \$2,24(\$fp)

b \$L4

nop

nop

lw \$2,24(\$fp)

move \$sp,\$fp

lw \$31,52(\$sp)

lw \$fp,48(\$sp)