Question: 2. [4pt] leaq is different from movq instruction. While Leaq is an address computation instruction that sets the Dest to address denoted by expression, movq
![2. [4pt] leaq is different from movq instruction. While Leaq is](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f51b80d43f0_39266f51b80441f7.jpg)


2. [4pt] leaq is different from movq instruction. While Leaq is an address computation instruction that sets the Dest to address denoted by expression, movq sets the Dest to the value at the address denoted by expression. The following figure shows the values stored in different registers and memory addresses. Explain each instruction and identify the results stored in register % rax and %rbx. leaq 0x4(88rdx, osrcx), osrax movq 0x4 (o8rdx, ofrcx), os rbx 3. [9pt] Individual bits in the single bit register (CF, ZF, SF, OF) give information about computation. 1) Given %ax=0x80,%bx=0x81. Determine the status of all bit registers in the following cases: a. addw 8 b. subw os.ax, 08bx c. subw bx, osax 2) Given %ax=0xFF,%bx=0x01. Determine the status of all bit registers in the following cases: a. addw 8ax,88bx b. subw o c. subw o, 88ax 4. [14] Fill in the missing expressions in the C code according to the given assembly code. short test (short x, short y, short z ) x in %rdi,y in %rsi,z in %rdx test: Starting with C code of the form leaq (%rdx,%rsi),%rax subq \%rdi, \%rax short test(short x, short y, short z) \{ cmpqjle$5,%rdx.L2shortval=if( cmpqjle$2,%rsi.L3if(if movq % rdi, \%rax val = idivq %rdx,%rax else idivq % rsi, \%rax val = ret return val; .L2: } [13pt] Write the c code for the corresponding assembly code. For a function with prototype long decode2(long x, long y, long z ); GCC generates the following assembly code: 12345678decode2:subqimulqmovqsalqsarqxorqret%rdx,%rsi%rsi,%rdi%rsi,%rax$63,%rax$63,%rax%rdi,%rax Parameters x,y, and z are passed in registers %rdi,%rsi, and %rrdx. The code stores the return value in register \%rax. Write C code for decode2 that will have an effect equivalent to the assembly code shown
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
