Question

Consider the following code fragment where the right-hand side of the assignments in func are to be completed by answering th

The compiler generates the following assembly code for the body of func: pushl %ebp movl %esp, Kebp movl 6x8C%ebp), Leax leal

WHAT is the value of A,B, and C

0 0
Add a comment Improve this question Transcribed image text
Answer #1

From my deciphering of the assembly code, I feel the answers shown in the image are right for A and B but C is 0.

A = sp1->p

B = sp1->s.x + sp1->s.y

C = 0

Add a comment
Know the answer?
Add Answer to:
WHAT is the value of A,B, and C Consider the following code fragment where the right-hand...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • the answer is movl 8(%ebp), %edx or movl 4(%ebp), %edx? Consider the following C and assembly...

    the answer is movl 8(%ebp), %edx or movl 4(%ebp), %edx? Consider the following C and assembly code: int increment(int x){ return x+1; } increment: 1 push? 2 movl 3 movl 4 addl 5 6 popl ret %ebp %esp, %ebp 8(%ebp), %eax $1, %eax %ebp Suppose we want to move the return address into register %edx on line 5. Write 1 line of assembly code to perform this action. (Write your answer with exactly 2 spaces: one after the instruction, and...

  • For the C code 1 int loop while(int a, int b) int result 1; while (a < b) t result (atb); return ...

    For the C code 1 int loop while(int a, int b) int result 1; while (a < b) t result (atb); return result; Gcc generates the following assembly code: %ebp+8, mov1 movl movl %ebp+12 at 8(%ebp) ,%ecx 12(%ebp) ,%ebx $1,%eax a at b 5 jge L11 leal (%ebx, %ecx), Xodx 8 L12: inull %eax , %eax addl $1,%ecx addl $1, edx cmp1 %ecx , %ebx 9 10 12 13 J8 14 ·L11: .L12 In generating this code, occ makes an...

  • You are charged with maintaining a large C rogram and you come across the following code...

    You are charged with maintaining a large C rogram and you come across the following code typedef struct int left a-struct a [CNT] int right b-struct; void testlint i, b-struct *bp) int n bp- left bp-rights a-struct ap &bp- ali] ap- Cap- idx] n; The declaration of the compile time constant CNT and the structure a struct are in a file for which you don't have necessary access privilege. Fortunately you have a copy of the o' version of code,...

  • Consider the following source code, where b, c, and d are constants declared with #define. You...

    Consider the following source code, where b, c, and d are constants declared with #define. You will need to determine the values for b, c, and d. struct lnode { char *str; struct lnode *next; } struct lnode A[b][c][d]; int store_ele(int h, int i, int j, struct lnode dest) { A[h][i][j] = dest; return sizeof(A);} On compiling this program (with -O2), GCC generates the following assembly code for the store_ele function: store_ele: movslq %edi, %rdi movslq %esi, %rsi movslq %edx,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT