answer.
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]
2 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]2 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
Which of the following attributes of a website indicates a more reliable source for information?
scoundrel [369]
An attribute of a website that will indicate a more reliable source of information is when the site ends in ".edu". It is a top-level domain for education. It would mean that this particular site is linked to universities, colleges or other educational sites thus it gives more information that is real and factual.
3 0
1 year ago
Charlie has a large book collection. He was keeping track of it in a spreadsheet, but it has grown big enough that he wants to c
zepelin [54]

Answer:

Check the explanation

Explanation:

Ans 1) storing the data in one single row comes with its own barriers and that is if you delete one of the record in the spreadsheet, all the equivalent records which you didn't wanted to delete would be deleted. For take for instance, if you wish to delete the record of author "James Taylor" then all the books he has written would also be deleted from the spreadsheet.

Ans 2) In 1NF, all row is expected to have only 1 tuple, but here in this spreadsheet the title field for Author "James Taylor" has 2 books, so it would be separated into single rows.

Ans 3) The table in the attached image below doesn't delete with Delete anomaly, i.e., for author "May Norton" if you delete this record, then the only book written by her would be deleted.

So, you have to convert this table into 2NF.

Make separate tables for Author and Book

Author(Author Name, Author Country)

Books(Author Name, Book title, Publisher, Publisher Location, Year, price)

This cannot be normalized any further.

3 0
1 year ago
When configuring a record type, an App Builder can configure the available value of a picklist field for the page layout. Which
Alla [95]

Answer:

Option (B) and (D) i.e., Type and Lead Source is the correct answer.

Explanation:

Because when the user configures the record type, Then, they can help that user to configure the value of the picklist fields for the page layout. So, The type and the lead source opportunity is available for the standard field that configure straightly in the type of record. That's why the following option is correct.

7 0
1 year ago
Which sources could provide reliable evidence for your claim? Check all that apply. a step-by-step guide listed at www.gettingto
kozerog [31]
The correct answer is:
<span>an article from the New York Times</span>a book by an educational researcher and  professor<span>a report from the US Department of Education at www.ed.gov</span>
7 0
1 year ago
Read 2 more answers
Which of the following statements are true about the growth of technology? Select 3 options.
love history [14]

Answer:

1. Currently, 67% of people on earth use at least one mobile device.

2. The general public began connecting to the Internet when the World Wide    Web was introduced in 1991.

3. By 1995, almost half of the world’s population was connected to the Internet.

Explanation:

I just took the test ;)

5 0
2 years ago
Other questions:
  • In a spreadsheet, the instructions for carrying out calculations are called __________. recalculations formulas templates macros
    13·1 answer
  • Pls help me. ask yourself what would jesus do...
    14·1 answer
  • The final step of the DHCP Discovery process is known as...
    8·1 answer
  • Monica needs to work on a document where she has to highlight topics in bold and add emphasis to some words in a paragraph using
    9·1 answer
  • Survey Q, Non-scoring: What role are you playing in your team?
    5·2 answers
  • Mobile computing has two major characteristics that differentiate it from other forms of computing. What are these two character
    8·1 answer
  • Insert the missing code in the following code fragment. This fragment is intended to call the Vehicle class's method. public cla
    14·1 answer
  • Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followe
    13·1 answer
  • Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
    9·1 answer
  • Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!