Question: please help c# 2. Given the following code: struct { int a; int b; char *cp; foo [10];; Assume that the starting address of array
![int b; char *cp; foo [10];; Assume that the starting address of](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66ef5204cd529_13266ef520474c53.jpg)


2. Given the following code: struct \{ int a; int b; char *cp; foo [10];; Assume that the starting address of array foo is in register %rdx. For each of the following, either write x86-64 assembly code that will load the value of that expression into register \%rax (or \%eax, as appropriate), or write a C assignment statement that would generate the given assembly (referencing array foo and assign it to a variable t ). The first one is done as an example. a. fo0[0],bmov14(%rdx), \%eax b. foo[1] ,a c. foo [i] .b, assuming 1 is in \%rex. d. A sume % rdi contains the value of j. salq4,%rdimovb8(%rdx,%rdi),%rax Problem 3. A certain function is declared: unsigned foo (unsigned x, unsigned y ): It compiles to the following assembly code: Problem 3. A certain function is declared: unsigned foo(unsigned x, unsigned y ); It compiles to the following assembly code: movl $0,% eax .L2: testl \%esi, \%esi je .L4 addl \%edi, \%eax subl $1, \%esi jmp .L2 .L4: movl $0,% eax . L2: testl \%esi, \%esi je . L4 addl \%edi, \%eax subl $1,% esi jmp. L2 . L4: ret Recall that the first argument is passed in \%rdi, the second in \%rsi, and the return value is passed in \%ray (or in this case, since it is a four-byte integer, \%eax). The C code has the following general structure: unsigned foo(unsigned x, unsigned y ) f unsigned result = while (_... \}. return result; a. Fill in the blanks with code that will result in the given assembly code (when compiled with 0g and ignoring endbr 64 . A. Fill in the blanks with code that will result in the given assembly code (when compiled with 0g and ignoring endbr64. b. What does the function compute
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
