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
) What is the ""Phantom Inspector""? (
matrenka [14]

Answer:

 Phantom inspection is the process of finding various defects in the documents according to the . Basically, it is a group of meeting that usually provide the synergy effects and the maximum defects can easily be detected. This entire process is known as phantom inspector.  

It is also made some assumptions regarding the inspection that is made by one and more than one individual.

This process are usually done by inspecting the each operation output with the given output requirements.

4 0
2 years ago
What is the purpose of flight simulator programs, and what are some of the benefits of using them?
saw5 [17]

Answer:

Flight simulators provide a cost-effective way for pilots to practice both routine and rarely-used skills. With simulator training, you can refine your skills in a variety of different flight scenarios that can be tailored to your specific goals.

Explanation:

hope this helps <3

6 0
2 years ago
Read 2 more answers
True/False: Each individual element of an array can be accessed by the array name and an element number, called a subscript. Tru
Dahasolnce [82]

Answer:

True

Explanation:

3 0
2 years ago
Arrange the steps in the process of manually installing software.
Ahat [919]

The correct sequence is: 5,3,1,4,2

When you are installing software on your computer you need to first open the CD-ROM and then insert the installation CD into the CD-ROM. If the contents of the CD opens, click on the executable file to start the wizard, and then follow the prompts in the wizard. Finally, you often need to reboot your computer after installing a new program.

5 0
3 years ago
Plz answer me will mark as brainliest ​
victus00 [196]

Answer:

Application

Explanation:

Application software comes in many forms like apps, and even on computers. The software is most common on computers of all kinds while mobile applications are most common on cellular devices.

3 0
3 years ago
Read 2 more answers
Other questions:
  • You are informed that all the users within the network are unable to access the Internet. You decide to start troubleshooting fr
    12·1 answer
  • According to the Computing Research Association, the number of undergraduate degrees awarded in computer science at doctoral-gra
    11·1 answer
  • The hardware to keep the output data when finished is a
    9·1 answer
  • Manuel is working on a project in Visual Studio. He wants to keep this program showing on the entire desktop, but he also needs
    13·1 answer
  • My computer just fried anybody know why it did that?
    14·2 answers
  • You wouldn't think a simple shop like Dippy Donuts would be an interesting target for hackers. But look beyond the donuts and yo
    7·1 answer
  • Which code must be included to use Turtle Graphics?
    14·2 answers
  • Pls help computer science I will give brainliest
    8·2 answers
  • Phân tích cạnh tranh của cocacola và pepsi
    5·1 answer
  • Consider the following variable declarations and initializations.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!