正在加载图片...
Jne L4 movl geba, eax popl ebx popl ebp may only use symbolic variablesx, y, i, and ret, from the source code in your expressions belor ou Based on the assembly code, fill in the blanks below in its corresponding C source code. ( Note do not use register names. int cat (int x, int y) int i, reti while( ret= return reti Problem7:(1*2+8*1.5=14pts) This problem tests your understanding of both control flow and multidimensional array layout Consider the following assembly code for a procedure moo () moo pushl ebp movl esp, ebp push1旨e pushl esi pushl geba movl $0, ecx novI Sarl, edi ov1sarr2+8,旨 mov18(sebp),岩eax 1ea10(,号eax,4),ebx 1ea1(岩ecx,ecx,2),岩eax mov1ebx,岩edx dd1(eax,号esi),暑edx mov1岩edx,(号eax,器edi) cmp1$10,号ecx movl ecx, beax pop1号ebx popl esi pop1岩edi popl ebp Page 5 of 7-Page 5 of 7 jne .L4 .L6: movl %ebx, %eax popl %ebx popl %ebp ret Based on the assembly code, fill in the blanks below in its corresponding C source code. (Note: you may only use symbolic variables x, y, i, and ret, from the source code in your expressions below — do not use register names.) int cat(int x, int y) { int i, ret; ret = ________; i = ________; while(_____________) { ret = _______________________; } return ret; } Problem 7: (1*2 + 8*1.5 = 14pts) This problem tests your understanding of both control flow and multidimensional array layout. Consider the following assembly code for a procedure moo(): moo: pushl %ebp movl %esp, %ebp pushl %edi pushl %esi pushl %ebx movl $0, %ecx movl $arr1, %edi movl $arr2+8, %esi movl 8(%ebp), %eax leal 0(,%eax,4), %ebx .L5: leal (%ecx,%ecx,2), %eax sall $2, %eax movl %ebx, %edx addl (%eax,%esi), %edx movl %edx, (%eax,%edi) incl %ecx cmpl $10, %ecx jle .L5 movl %ecx, %eax popl %ebx popl %esi popl %edi popl %ebp ret
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有