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
-
What is the main difference between Supervised Learning and Contrastive Learning in Convolutional Neural Networks? Answer choices Select only one option Supervised Learning maximizes the similarity...
-
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
-
For this prompt, consider your academic goals, including (but not limited to) such topics as how you plan to manage your time to fit in your studies; how you will build your skills, as needed; how...
-
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...
-
Consider three independent cases for the cash flow data of Rennie Recreation Products Inc.: Required For each case, identify from the cash flow statement how Rennie Recreation Products Inc. generated...
-
Evaluate each of the following. (10 + 10) 0
-
What are the advantages and disadvantages of permitting counter-claims for insurance claims to be offset in financial reports? Consider the views of management, shareholders and a non-governmental...
-
Using the financial data shown in Exercise 2-17 for Polaris Realty Inc., prepare a retained earnings statement for the month ending November 30, 2011.
-
Tempo Company's fixed budget (based on sales of 18,000 units) folllows. Fixed Budget Sales (18,000 units x $205 per unit) Costs Direct materials Direct labor Indirect materials Supervisor salary...
-
Funtime, Inc., manufactures video game machines. Market saturation and technological innovations caused pricing pressures that resulted in declining profits. To stem the slide in profits until new...
-
Consider the differential equation with initial condition y(0) = 2. A. Use Euler's method with two steps to estimate y when x = 1: y(1) ~ (Be sure not to round your calculations at each step!) Now...
-
Which of the following create ResultSet protocols is correct? a. Statement createStatement(int resultSetType, int resultSetConcurrency). b. PreparedStatement prepareStatement(String sql, int...
-
List six steps to use the Java runtime object to perform data manipulations against our target database.
-
By using which of the following static constant values can we set an UpdaTable Result object whose contents can be updated? a. ResultSet.TYPE_FORWARD_ONLY b. ResultSet.TYPE_SCROLL_INSENSITIVE c....
-
The executeQuery() method will definitely return a query result, but the executeUpdate() method will never return any result. (True/False)
-
When converting an image file to a Byte[] array, one can use a system method, readAllBytes(). (True/False)
-
What are the half-reactions for the following reference electrodes? Include physical states. (a) The silver-silver chloride electrode. (b) The saturated calomel electrode. (c) What is the voltage of...
-
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...
-
Cookie Creations is gearing up the winter holiday season. Natalie has had a busy month of December. She needs to journalize and post the month's transactions and complete the accounting cycle,...
-
In her business, Monica Zapata uses a journal with the following columns: Date, Account Title, Check No., Cash Debit, and Cash Credit. Ms. Zapata's husband, Rodrigo, suggests that she needs three...
-
Justin Harris started a small merchandising business in 2006. The business experienced the following events during its first year of operation. Assume that Harris uses the perpetual inventory system....
Study smarter with the SolutionInn App