[SOLVED] CS代写 LFB23:

30 $

File Name: CS代写_LFB23:.zip
File Size: 141.3 KB

SKU: 7427591635 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


1) Consider the following source code, where R, S, and T are constants declared with #define: long A[R][S][T];
long store_ele(long i, long j, long k, long *to)
*to = A[i][j][k];
return sizeof(A);

Copyright By PowCoder代写加微信 assignmentchef

In compiling this program, gcc generates the following assembly code:
long store_ele(long i, long j, long k, long *to)
i in %rdi, j in %rsi, k in %rdx, to in %rcx
1 store_ele:
2 leaq (%rsi,%rsi,2), %rax
3 leaq (%rsi,%rax,4), %rax
4 movq %rdi, %rsi
5 salq $6, %rsi
6 addq %rsi, %rdi
7 addq %rax, %rdi
8 addq %rdi, %rdx
9 movq A(,%rdx,8), %rax
10 movq %rax, %(rcx)
11 movl $3640, %eax
A. Which register used to pass each one of the arguments?
B. Use your reverse engineering skills to determine the values of R, S, and T based on this assembly code. Write your answer here:
R == S == T ==

2) Consider the following assembly code:
.file “StudyGuide.c”
.globl my_proc
.type my_proc, @function
my_proc: .LFB23:
movl $0, %eax
movl $0, %edx .L2:
cmpl %edi, %eax jge .L4
addl $2, %edx addl $1, %eax jmp .L2
movl %edx, %eax
ret .LFE23:
.size my_proc, .-my_proc
.section .LC0:
.string “The sum is %d.

” .text
.globl main
.type main, @function
main: .LFB24:
subq $8, %rsp
movl $5, %edi
call my_proc
movl %eax, %edx
leaq .LC0(%rip), %rsi movl $1, %edi
movl $0, %eax
call movl $0, %eax
addq $8, %rsp .cfi_def_cfa_offset 8
.size main, .-main
.ident “GCC: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0″ .section
.section .note.gnu.property,”a”
.long 1f – 0f .long 4f – 1f .long 5
Page 2 of 3

.string “GNU”
.long 0xc0000002
.long 3f – 2f 2:
.long 0x3 3:
.align 8 4:
Write the code for the procedure my_proc.
What is printed by function printf?
Page 3 of 3

程序代写 CS代考加微信: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代写 LFB23:
30 $