2. The gcc C compiler generates the assembly code blow to the right. Reverse engineer the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. The gcc C compiler generates the assembly code blow to the right. Reverse engineer the operation of this code and fill in the missing parts of the C code to the left so that it does the same thing. long loop(long x, long n){ } long result long mask; for (mask mask = result = = } return result; ; ){ # x in %rdi, n in %ęsi Loop: .L3: .L2: mov mov] mov imp mova anda ora salg testa ine_ ret %esi, %ecx $1, %edx $0, %eax .L2 %rdi, %r8 %rdx, %r8 %r8, %rax %cl, %rdx %rdx, %rdx .13 2. The gcc C compiler generates the assembly code blow to the right. Reverse engineer the operation of this code and fill in the missing parts of the C code to the left so that it does the same thing. long loop(long x, long n){ } long result long mask; for (mask mask = result = = } return result; ; ){ # x in %rdi, n in %ęsi Loop: .L3: .L2: mov mov] mov imp mova anda ora salg testa ine_ ret %esi, %ecx $1, %edx $0, %eax .L2 %rdi, %r8 %rdx, %r8 %r8, %rax %cl, %rdx %rdx, %rdx .13
Expert Answer:
Answer rating: 100% (QA)
To reverse engineer the assembly code provided into C we need to understand each instruction and how ... View the full answer
Related Book For
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron
Posted Date:
Students also viewed these algorithms questions
-
A function test_one has the following overall structure: Reverse engineer the operation of this code and then do the following: A. Determine what loop translation method was used. B. Use the...
-
Motion of Electrons in a Magnetic Field An electron of mass m and charge -e is moving through a uniform magnetic field B = (B, 0, 0) in vacuum. (Figure 1)At the origin, it has velocity (Uz, Vy, 0),...
-
Research a country on the African continent that you think would be the most advantageous to your company in cultural, economic, and political environments. Your company wants to put a ball-bearing...
-
The integrated report framework In 2013, the International Integrated Reporting Council (IIRC) released a framework for integrated reporting. The framework establishes principles and concepts that...
-
What is the difference between object-oriented languages and UML?
-
Foy Company has a welding activity and wants to develop a flexible budget formula for the activity. The following resources are used by the activity: Four welding units, with a lease cost of $12,000...
-
Aloha Inc. has 7 percent coupon bonds on the market that have 12 years left to maturity. If the YTM on these bonds is 8.1 percent, what is the current bond price?
-
Kenmare Architects Ltd. (KAL) was incorporated and commenced operations on January 1, 2014. Sheila Kenmare, the company's only employee, consults with various clients and uses expensive equipment to...
-
What is the most likely prediction after a firm reduces its regular dividend payment? Select one: a. Capital investments are likely expected to increase b. Future profits are likely expected to...
-
Outline a procedure for graphing a line using the slope-intercept method.
-
a. Elaine is twenty years old, and Philip, a bachelor, is seventy-five. Philip asks Elaine to marry him. Philip has terminal cancer and wants to die a married man. He and Elaine know that he probably...
-
Examine the following sequence of events: Ann and Rich meet in State Y where they agree to live together as husband and wife forever. They do not want to go through a marriage ceremony, but they...
-
For the following questions, examine the statutory code of your state. a. Has a dower been abolished in your state? If so, give the citation to the statute that abolished it. b. If a widow is not...
-
In your state, can one spouse use wiretap evidence against the other spouse at the divorce hearing (e.g., the wife taps her husbands phone and wants to introduce into evidence the conversation he had...
-
The average temperature for Wednesday, Thursday and Friday was 39 C. The average for Thursday, Friday and Saturday was 42 C, what is the difference in temperatures on Saturday and Wednesday? 1. 2 C...
-
Write an essay describing the differing approaches of nursing leaders and managers to issues in practice. To complete this assignment, do the following: 1. Select an issue from the following list:...
-
For each byte sequence listed, determine the Y86-64 instruction sequence it encodes. If there is some invalid byte in the sequence, show the instruction sequence up to that point and indicate where...
-
In the C function that follows, we have omitted the body of the switch statement. In the C code, the case labels did not span a contiguous range, and some cases had multiple labels. In compiling the...
-
Assume data type int is 32 bits long and uses a twos-complement representation for signed values. Right shifts are performed arithmetically for signed values and logically for unsigned values. The...
-
Which of the following approaches is used to study management? Art Process Science Profession
-
Management is Ongoing process Social process Integrated process All the above
-
Which is the correct order for the process of management? Planning, organizing, staffing, directing, and controlling Planning, organizing, directing, staffing, and controlling Planning,...
Study smarter with the SolutionInn App