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

preco sa 45 FC 401803 ca eax, [ebp-4 i assune stack fixed up betore ret Bleek #7 is accomplished by the overall function? Be Specifict After the function call, what is the value function? out the contents of phrase exactly as they would appear. Writing Code (40 pts) 6. (40 pts) Translate the following C code into assembly code. Do NOT write your own strienC) function, just call it correctly char phrase!l - Almost DONE! int x -strlen(phrase), y whilet ysx assume that prase aiready iniciaiise it phraselyl D break // capital D0x44 return yi BONUS (5 pts) What value is returned in this case7 push ebp mov ebp, esp sub esp, 24 phrase [ebp-161,x e [ebp-201, y [ebp-24 here. do NOT Write the code to do it 3843 Computer Organization -Final Exam 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

Expert Answer

 

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
Order Essay

6)

char phrase[] = “Almost DONE!”;

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

while(y<x) {

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

y++;

}

return y;

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

sample():

addiu $sp,$sp,-56

sw $31,52($sp)

sw $fp,48($sp)

move $fp,$sp

lui $2,%hi($LC0)

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

addiu $3,$2,%lo($LC0)

lw $4,4($3)

addiu $3,$2,%lo($LC0)

lw $3,8($3)

sw $5,32($fp)

sw $4,36($fp)

sw $3,40($fp)

addiu $2,$2,%lo($LC0)

lbu $2,12($2)

nop

sb $2,44($fp)

addiu $2,$fp,32

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)

addiu $3,$fp,24

addu $2,$3,$2

lb $3,8($2)

li $2,48 # 0x30

beq $3,$2,$L6

nop

lw $2,24($fp)

nop

addiu $2,$2,1

sw $2,24($fp)

b $L4

nop

nop

lw $2,24($fp)

move $sp,$fp

lw $31,52($sp)

lw $fp,48($sp)

addiu $sp,$sp,56

j $31

nop

Still stressed from student homework?
Get quality assistance from academic writers!