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]
1 year 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]1 year 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
Java languageThe cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.1. Declare a constant named CENTS_PER_
Sophie [7]

Answer:

// Here is code in Java.

// import package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

    try{

   // variables

    final int CENTS_PER_POUND = 25;

    final int FLAT_FEE_CENTS = 75;

    // Scanner object to read input

   Scanner sr=new Scanner(System.in);

   System.out.print("Enter the shipping weight:");

   // read the input weight

   int shipWeightPounds=sr.nextInt();

   // calculate total cost

  int shipCostCents = (shipWeightPounds * CENTS_PER_POUND) + FLAT_FEE_CENTS;

  // print Weight

  System.out.println("shipping  Weight: " + shipWeightPounds);

  // print flat fee

     System.out.println("flat fee of shipping in cents : " + FLAT_FEE_CENTS);

     // print cents per round

     System.out.println("Cents/pound for shipping: " + CENTS_PER_POUND);

     // print cost of Shipping

    System.out.println("total cost of shipping in cents: " + shipCostCents);

   

   

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize two constant variables "CENTS_PER_POUND=25" & "FLAT_FEE_CENTS = 75". Read the input weight from user with the help of Scanner class object. Then  calculate the cost of shipping by multiply weight with cent per pound and add flat fee. Then print each of them.

Output:

Enter the shipping weight:12                                                                                                                                  

shipping  Weight : 12                                                                                                                                        

flat fee of shipping in cents: 75                                                                                                                              

Cents/pound for shipping: 25                                                                                                                                  

total cost of shipping in cents: 375  

8 0
1 year ago
Read 2 more answers
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
If there are 8 opcodes and 10 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the
Nimfa-mama [501]

Answer:  

For 32 bits Instruction Format:

OPCODE   DR               SR1                   SR2      Unused bits

a) Minimum number of bits required to represent the OPCODE = 3 bits

There are 8 opcodes. Patterns required for these opcodes must be unique. For this purpose, take log base 2 of 8 and then ceil the result.

Ceil (log2 (8)) = 3

b) Minimum number of bits For Destination Register(DR) = 4 bits

There are 10 registers. For unique register values take log base 2 of 10 and then ceil the value.  4 bits are required for each register. Hence, DR, SR1 and SR2 all require 12 bits in all.  

Ceil (log2 (10)) = 4

c) Maximum number of UNUSED bits in Instruction encoding = 17 bits

Total number of bits used = bits used for registers + bits used for OPCODE  

     = 12 + 3 = 15  

Total  number of bits for instruction format = 32  

Maximum  No. of Unused bits = 32 – 15 = 17 bits  

OPCODE                DR              SR1             SR2              Unused bits

  3 bits              4 bits          4 bits           4 bits                17 bits

7 0
1 year ago
1. A pure aggregator is best defined as a blog that
miss Akunina [59]
A pure aggregator is best defined as a blog that aggregates blog content from other sources.

An Aggregator blog or website don't write its own content. It aggregates information or content from third-party websites. There are different types of aggregator websites such as a poll aggregator, a review aggregator, and a search aggregator.
5 0
1 year ago
Develop an EER model for the following situation using the traditional EER notation, the Visio notation, or the subtypes inside
podryga [215]

Answer:

Explanation:

To develop the model for Creating the supertype/subtype relationship three diffrent types of notation is given bellow accrdig to the diagram attached.

1.Traditional EER (Enhance Entity-Relational) notation

2.Microsoft Visio notation

3.Subtypes Inside supertype note

<em><u>Traditional EER(Enhance Entity-Relational)notation for the international school of technology diagram is attached bellow</u></em>

The diagram consist of the following entity

Room Supertype

Media Entity Type

COURSE entity type

Section weak entity type

Schedule associatiative entity type

<u><em>Microsoft Visio Notation for the international school of technology  is ashown in the diagram bellow.</em></u>

The diagram consist of the following entity

Room Supertype

Media Entity Type

Computer entity type

Instructor entity type

Time slot entity type

<u><em>Subtype Inside Supertype note Notation for the international school of technology  is shown in the diagram bellow.</em></u>

The diagram consist of the following entity

Room Supertype

Media Entity Type

Computer entity type

Instructor entity type

Time slot entity type

3 0
2 years ago
Other questions:
  • In object oriented programming, what is another name for the "attributes" of an object?
    14·1 answer
  • Assume that the reference variable r refers to a serializable object. Write code that serializes the object to the file ObjectDa
    8·1 answer
  • Universal Containers needs a field on the Account to track how many Opportunities are closing within the next 30 days. What can
    9·1 answer
  • Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation
    6·1 answer
  • Write a loop that counts the number of space characters in a string. Recall that the space character is represented as ' '.
    11·1 answer
  • You are the IT security administrator for a small corporate network. Samuel Garcia (sgarcia) has been away on vacation and has f
    9·1 answer
  • Which of the following option is correct about HCatalog?
    14·1 answer
  • A triangular number is a number that is the sum of the integers from 1 to some integer n. Thus 1 is a triangular number because
    11·1 answer
  • A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (1) Ou
    15·1 answer
  • Ryan has made a presentation of ten slides, which he wants to display in sequence after a specific time interval. Which element
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!