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
A list cannot use appendleft but a _____ can.
Dmitry [639]

Answer:

String

Explanation:

I think it is this one.

3 0
3 years ago
Write a method isSorted that returns true if the list is in sorted (nondecreasing) order and returns false otherwise. An empty l
kozerog [31]

Answer:

// This method is written in Java Programming Language

// Comments are used for explanatory purpose

// Method starts here

// Declare method isSorted

public boolean isSorted() {

// Create a listnode

ListNode lst = list;

// Check if list is null

if (list == null) {

return true;

}

// Iterate while list is not null

while (lst.next != null) {

// Get current list item

ListNode current = lst.next;

// Compare; if less than, return false

if (current.data < lst.data) {

return false;

}

// Assign current to lst

lst = current;

}

return true;

}

8 0
3 years ago
Consider the information about the meaning of the word analog from paragraph 2 listed below. Which of the following phrases best
Reika [66]

Answer:

drzvkhy67re4d

Explanation:

Preciate u

3 0
3 years ago
In which utility is the file search option found in windows
OLEGan [10]

Press Windows logo key + X Key.

Click on Control Panel.

Double Click on Troubleshooting.

Click on View all option, on left hand side of the window.

Click on Search and indexing and follow the on screen instructions.

5 0
3 years ago
What is a sign that content is
Sidana [21]
D. All of the above
7 0
4 years ago
Read 2 more answers
Other questions:
  • __________ is a website that offers a variety of Internet services from a single, convenient location.
    13·1 answer
  • When parallel sections of oxygen and fuel gas hoses are taped together, only _____ inches out of 12 inches should be covered by
    8·2 answers
  • The creation of​ __________ with digital media allows for large quantities of numerical or textual data to be searched online by
    10·2 answers
  • You want to centrally back up the files users store in the Documents folder in their user profiles, but you don’t want users to
    7·1 answer
  • A _____ is inserted so that a portion of a document that can have different formatting from the rest of the document. a. heading
    9·1 answer
  • NEED FIVE QUESTIONS ANSWERED!!!
    7·1 answer
  • Which user characteristic may not be used to change keyword bids in adwords?:?
    11·1 answer
  • 6 → What is the difference between SHA-256 and SHA-512?
    12·1 answer
  • For (int j- 4; j &gt; 0; j--)
    9·1 answer
  • Choose the missing words in the code below.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!