Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Copy the above x86-64 code into a C file as a comment. Annotate each line of the x86-64 code in terms of x, y, result,

Copy the above x86-64 code into a C file as a comment. Annotate each line of the x86-64 code in terms of x, y, result, and mask. Assume that this x86-64 code follows the register usage conventions outlined in B&OH section 3.7.5 (it does). Then implement the above C function by filling in the blanks so that its functionally equivalent to the x86-64 code.

image text in transcribedimage text in transcribed

1. [20] Consider the following x86-64 code: loop: mova &rsi, frcx movl $1, feax movl $0, fedx .L2: testq frax, frax je .L4 mova frax, $r8 anda %rdi, &r8 org fr8, rdx salq fcl, frax jmp . L2 .L4: mova Srdx, frax ret The code above was generated by compiling C code (with Arch gcc) that has the following overall form: long loop (long a, long b) { long result = 0; for (long mask = ?; mask != ?; mask

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions