1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gnesinka [82]
3 years ago
5

int decode2(int x, int y, int z); is compiled into 32bit x86 assembly code. The body of the code is as follows: NOTE: x at %ebp+

8, y at %ebp+12, z at %ebp+16 movl 12(%ebp), %edx subl 16(%ebp), %edx movl %edx, %eax sall $31, %eax sarl $31, %eax imull 8(%ebp), %edx xorl %edx, %eax Parameters x, y, and z are stored at memory locations with offsets 8, 12, and 16 relative to the address in register %ebp. The code stores the return value in register %eax. The shl or sal instruction is used to shift the bits of the operand destination to the left, by the number of bits specified in the count operand Write C code for decode2 that will have an effect equivalent to our assembly Code. int decode2(int x, int y, int z) { }
Computers and Technology
1 answer:
kherson [118]3 years ago
8 0

Answer: provided in the explanation segment

Explanation:

This looks a bit confusing but you can follow through using the provided code.

/*

Line 1. x at %ebp+8, y at %ebp+12, z at %ebp+16

Line 2. movl 12(%ebp), %edx

Line 3. subl 16(%ebp), %edx

Line 4. movl %edx, %eax

Line 5. sall $31, %eax

Line 6. sarl $31, %eax

Line 7. imull 8(%ebp), %edx

Line 8. xorl %edx, %eax

*/

#include<stdio.h>

// function decode above program

int decode2(int x,int y,int z){

  // In Line 2 y is stored in variable

  int var1 = y;

 

  // In Line 3 subtract z from var1 and store in var1

  var1 = var1 - z;

  // In Line 4 move var1 value to another value count

  int count = var1;

  // In Line 5 left shift by 31 value in count

  count<<31;

  // In Line 6 right shift by 31 value in count

  count>>31;

  // In Line 7 multiply x with value in var1

  var1 = var1*x;

  // In Line 8 xor the var1 and count and store in count

  count = var1 ^ count;

  // return count;

  return count;

}

// main function for testing

int main(){

  printf("Enter the value of x ");

  int x;

  scanf("%d",&x);

  printf("Enter the value of y ");

  int y;

  scanf("%d",&y);

  printf("Enter the value of z ");

  int z;

  scanf("%d",&z);

  printf("value of decode2(%d,%d,%d) is %d\n",x,y,z,decode2(x,y,z));

  return 0;

}

cheers i hope this helps

You might be interested in
Write, compile, and execute a C program that calculates and returns the fourth root of the number 81.0, which is 3. (hint: The f
alex41 [277]

Answer:

   result=pow(value,0.25);

   printf("The 4th root is:%2.f",result);

Explanation:

In order to accomplish the task we need a library called math.h.

//4 root code

#include <stdio.h>

#include <math.h> //adding the library math.h

int main()

{  

   double value=81.0,root=0.25,result; //declaring the variables

   result=pow(value,root); //The function Pow will return the power raised to the base number

   printf("The 4th root is:%2.f",result); //print the result

   return 0;

}

3 0
3 years ago
Charlie wants you to include the following topics in your presntation: an overview of project management and its hrity,a descrip
maxonik [38]

Answer:

Explanation:

Project management is the process of planning, designing and implementing a project in an organized way to achieve the goals of an organization.

The project management process includes various activities like,

Definition – Initializing the project, identifying the needs

Planning – Organizing the activities and schedule the tasks

Execution – Coordinating people and resources and implement the tasks

Control – Monitoring the implementations, ensuring the objectives and goals

Closing – Acceptance of the project.

Task identification:

• Tasks are derived from the project deliverables and the requirements of the deliverables and the goals.

• All activities required for a complete process are to be identified.

• Identify intermediate deliverables for each major component

Relationships among tasks

The tasks can be interrelated. Start of completion of one task may depend on the start or end of another task. There can be four types of relationships among the tasks. They are:

• Finish-to-start – Task (B) cannot start until task (A) finishes

• Start-to-Start - Task (B) cannot start until task (A) starts

• Finish-to-Finish - Task (B) cannot finish until task (A) finishes

• Start-to-Finish - Task (B) cannot finish until task (A) starts

Schedule development:

Schedule development depends on the requirement, resources, duration and end date of the project. It provides a basis for monitoring the project progress.

• Gantt chart, PERT, CPM are the tools used to represent the project schedule.

• Gantt chart is the common tool for displaying project schedule information. They are easy to create and understand.

• These tools are useful at many stages of project management.

• They give critical path and slack time. Provide project documentation. They are useful in monitoring costs

4 0
4 years ago
Write a 2-to-3-page research paper describing in plain language the basic purpose, theory, and implementation of GUI application
laila [671]

Answer:

       

Explanation:

4 0
3 years ago
Next, Sue decides to embed a chart from Microsoft Word. She copies and pastes data from a table that she has already created in
antoniya [11.8K]

Answer:

Its D

Explanation:

On Edg

8 0
3 years ago
Im trying to type in answers but where the text box is supposed to be it says unlock answers. What does that mean?
borishaifa [10]
You may have to pay or sign up for the text box or if it is a computer program you may need to get the full version of the software if it is a trial
3 0
3 years ago
Other questions:
  • The rectangular marquee tool can select an area to be used as a pattern?<br> True<br> False
    5·1 answer
  • What is the outside of an iPhone called?
    9·2 answers
  • I'm looking for the best free chat website to Answer computer and statistic question and answers
    10·2 answers
  • 1. Some of the music in the 1960s was used to protest social and political issues. Is music still used as a form of protest? Why
    13·1 answer
  • What is a systems development life cycle?
    5·1 answer
  • Distinguish between exponentiation and modulus. Be specific.
    5·1 answer
  • What can a Word user do with the Customize Ribbon dialog box? Check all that apply.
    7·1 answer
  • What is the database and presentation for files​
    14·2 answers
  • How do I mark brainlyist
    7·2 answers
  • What type of block start a sequence?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!