Answered step by step
Verified Expert Solution
Question
1 Approved Answer
the C function p 7 is compiled to the x 8 6 code shown on the right ( the integer array p is created elsewhere
the C function p is compiled to the x code shown on the right the integer array p is created elsewhere in the x codecomplete the definition of the C function p on the left, so that it does the same thing as the assembly code on the right. movXY transfers data of size X from the source register to overwrite data of size Y in the destination register, sets any extra bits of the destination to s X and Y can be b w l or q for and bit, respectively movsXY does the same, except the sign but of the source is extended in the destination. cltq is equivalent to movslq eax rax. const int p; int pchar s int n int c; int d; for int i; # a in rdi, n in esi p: pushq rbp movq rsprbp movq rdi, rbp movl esi, rbp movl $rbp movl $rbp jmp LL: movl rbpeax movslq eax, rdx movq rbprax addq rdxrax movzbl rax $eax movsbl aeax andl $eax movl eax, rbp movl rbpeax cltq movl prax,eax addl eax, rbp addl $rbpL: movl rbpeax movslq eax, rdx movq rbprax addq rdxrax movzbl raxeax testb alal jne L cmpl $rbp jne L movl $eax jmp LL: movl $eax L: popq rbp retff
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started