Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need urgently! Please follow instructions of lab and code all three functions ( main , sort, search ) according to the lab instructions. Thank you!

Need urgently! Please follow instructions of lab and code all three functions(main, sort, search) according to the lab instructions. Thank you! The general outline of the code is given as: Question 2- main.
The main function should do the following:
call the sort function
ask the user to input an unsigned integer number between 0,100(inclusive) in the
terminal, using scanf and save this number in the location val.
call the search function and pass the val to the function using the RCX register.
if the return value of the RAX register is -1, then print to the terminal the string array
printf_notfound. This require the val as one of the parameters.
if the return value of the RAX register is the location of the found val, then print to
the terminal the string array printf_found. This requires the val and the location
as returned by the RAX register. A sample main outline can be given as: Question 3- sort.
The sort function should do the following:
sort the array in place using Insertion Sort Algorithm.
no restrictions on number of used register.
no restrictions is placed on stack use and local variables.
A sample sort outline can be given as:Question 4- search.
The search function should do the following:
accept the number from main in the RCX register (i.e. incoming frame macro should
be at least 1)
create a local variable and save this number on the stack (i.e. the second parameter
of frame macro should be at least 1).
return -1 in RAX register if the value is not found in the array
return the location of the value in the RAX register if the value is found in the array.
no other restrictions on number of used register.
no other restrictions is placed on stack use and local variables.
A sample search outline can be given as:
Constraints
Please note that values can only be passed into function using specific registers in strict
order. Also certain registers must be preserved inside functions. Therefore, care must be
taken in selection of which registers to use.
image text in transcribed

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions