Continuing, write assembly language instructions-not a complete program-that imp
ID: 3667324 • Letter: C
Question
Continuing, write assembly language instructions-not a complete program-that implements line 4 of this C code (where the variables a, b, c, d, w, x, y, and z on line 1 were defined in the data section of Exercise 2). Line 4 requires 13 assembly language instructions, including the instructions that load the addresses and values of the variables into registers and the instruction that writes the result to the memory location allocated to w. For full credit, write a comment for each instruction explaining what the instruction is doing. ~(c | d) is c NOR d.Explanation / Answer
Answer:
The Line4 in the above instruction i.e w=(a&b)^-(c|d); changed into assembly language code including the loading of addresses instructions is shown as below :
Assembly Code:
0004 8B150000 movl a(%rip), %edx
000a 8B050000 movl b(%rip), %eax
0010 89D1 movl %edx, %ecx
0012 21C1 andl %eax, %ecx
0014 8B150000 movl c(%rip), %edx
001a 8B050000 movl d(%rip), %eax
0020 09D0 orl %edx, %eax
0022 F7D8 negl %eax
0024 31C8 xorl %ecx, %eax
0026 89050000 movl %eax, w(%rip)
002c B8000000 movl $0, %eax
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.