Write a C function func that performs the actions of the following assembly code. Your function...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a C function func that performs the actions of the following assembly code. Your function must be named func. The function takes four arguments passed in registers %edi, %esi, %edx and %rcx. The function returns a single argument in %eax. func: .L3: .L2: movl %edi, %eax Test movslq cmpl je addl cmpl jl movl ret For example: %eax, %rdi %esi, (%rcx, %rdi, 4) .L2 $1, %eax %edx, %eax .L3 $-1, %eax Result test (1, target1); OK1 Write a C function func that performs the actions of the following assembly code. Your function must be named func. The function takes four arguments passed in registers %edi, %esi, %edx and %rcx. The function returns a single argument in %eax. func: .L3: .L2: movl %edi, %eax Test movslq cmpl je addl cmpl jl movl ret For example: %eax, %rdi %esi, (%rcx, %rdi, 4) .L2 $1, %eax %edx, %eax .L3 $-1, %eax Result test (1, target1); OK1
Expert Answer:
Answer rating: 100% (QA)
The assembly code provided in the image is performing some operations that are to be replicated by writing an equivalent C function named func Lets first explain what the assembly code is doing step b... View the full answer
Related Book For
Computer Organization And Design The Hardware Software Interface
ISBN: 9780123747501
4th Revised Edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these programming questions
-
The position vs time plot of an ant is shown in Figure 1. x-position (m) LO 5 Oa -5 C 5 d e A Question 3 (1 point) Retake question (b) What is the x-displacement between a and f? t (s) 10
-
A 0.1 cm thick flat copper plate, 2.5 m x 2.5 m square is to be cooled in a vertical position. The initial temperature of the plate is 90?C with the ambient fluid at 30?C. The fluid medium is either...
-
The following information was disclosed during the audit of Zheng Group. 1. Year Amount Due per Tax Return 2018..........................................130,000,000...
-
Choke Cherry Ltd. is a private company reporting under ASPE. Its adjusted trial balance at its fiscal year end, December 31, 2021, is shown below: Instructions Prepare an income statement, statement...
-
An engineer prepares a report to evaluate a project using PW and IRR. Just before submitting the report, he spills coffee on it, making the first digit of the 2-digit IRR unreadable. The second digit...
-
Quaint Construction, Inc., is a home builder in Arizona. Quaint uses a job order costing system in which each house is a job. Because it constructs houses, the company uses an account titled...
-
In a random walk suppose that at t = (n - 1)At the particle is located at x = max. The assumption is that at t = nAt the particle will have moved to x = (m+1)Ax with probability 3/4 or to x = (m-3)Ax...
-
Twobucks Coffee Company currently operates 12 coffee shops in downtown Nashville. The company has been losing money and wants to downsize by closing some stores. Its policy has been to saturate the...
-
(6%) Problem 8: A circuit consisting of 5 resistors is shown in the graph. Their resistances are R = 18 Q, R = 35 Q, R3 = 81 Q, R4 = 34 22, and R5 = 32 22, and the emf of the battery is = 9.5 V....
-
Economists believe that energy plays three key roles in our lives. Explain.
-
Define the idea of lifetime of a resource as a measure of resource scarcity. Why don't most economists believe it is a helpful measure?
-
Why do the predictions of the simple version of Hotelling's rule not always hold?
-
'Sometimes biodiversity conservation policies can make things worse.' Discuss this statement in relation to a specific policy.
-
Define what might represent a cost-effective conservation policy.
-
The electron in the hydrogen atom is subjected to a magnetic field produced by the proton. Explain this phenomenon. (i) Given that the radius of the electron orbit is r and the electron speed is v,...
-
l ask this second time correnct answer is 38,01 can we look pls Consider a non-conducting rod of length 8.8 m having a uniform charge density 4.5 nC/m. Find the electric potential at P, a...
-
Given this breakdown of execution cycles in the processor with direct support for the ADDM instruction, what speedup is achieved by replacing this instruction with a 3-instruction sequence (LW, ADD,...
-
Find the word or phrase from the list below that best matches the description in the following questions. Use the numbers to the left of words in the answer. Each answer should be used only once....
-
What is the power dissipated in watts (joules per second)? Problems in this exercise assume that, during an execution of the program, processor cycles are spent in the following way. A cycle is...
-
For several years, the Otis Capital USA Corp has been exploring for gold on its mining claims held on public lands near the Idaho-Montana border. Otis filed a proposal to expand its current...
-
When GTE Sylvania discovered it was losing market share to other television manufacturers, it developed a franchise plan that limited the number of retailers selling its product in each area....
-
Visa, MasterCard, American Express, and Discover control practically all credit card transactions in the United States. The credit card industry is a two-sided market; that is, cardholders benefit...
Study smarter with the SolutionInn App