QuestionQuestion

Transcribed TextTranscribed Text

Disassemble x86-64 Code Consider the following assembly code: The preceding code was generated by compiling C code that had the following overall form: long loop(long x, long n) { long result = __________; long mask; for (mask = __________; mask __________; mask = ______________) { result |= _______________; } return result; } Your task is to fill in the missing parts of the C code to get a program equivalent to the generated assembly code. Recall that the result of the function is returned in register %rax. You will find it helpful to examine the assembly code before, during and after the loop to form a consistent mapping between the registers and the program variables. A. Which registers hold program values x, n, result, and mask? B. What are the initial values of result and mask? Variable x n result mask Register variables result mask initial value

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

long loop(long x, long n)
{
long result = 0;
long mask;
for (mask = 1; mask != 0; mask = mask << (n & 0xFF)) {
result|= x & mask;
}...

By purchasing this solution you'll be able to access the following files:
Solution.docx.

50% discount

Hours
Minutes
Seconds
$25.00 $12.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats