I need some help on this assembly question, it has to
be done strictly in Intel x86 64 bit assembly language and the
other part in C language
copyable code:
Assembly code for findRange():
_findRange:
;set the parameters
;store the register-values
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
;numberArray
movl 8(%ebp), %edi
;count
movl 12(%ebp), %esi
movl (%edi), %ebx
testl %esi, %esi
jle L13
movl %ebx, %eax
xorl %ecx, %ecx
.p2align 2,,3
L5:
movl (%edi,%ecx,4), %edx
cmpl %edx, %ebx
jge L6
movl %edx, %ebx
L6:
cmpl %edx, %eax
jle L7
movl %edx, %eax
L7:
incl %ecx
cmpl %esi, %ecx
jne L5
subl %eax, %ebx
movl %ebx, %eax
popl %ebx
popl %esi
popl %edi
leave
ret
L13:
xorl %eax, %eax
;restore the register-values
popl %ebx
popl %esi
popl %edi
leave
;return to caller
ret
C code for findRange():
//Return the range
int findRange(int *numberArray, int count)
{
//declare the needed variables
int kk;
//define maxx and minn
int maxx=numberArray[0];
int minn=numberArray[0];
//loop to find the maxx and minn in numberArray
for(kk=0;kk<count;kk++)
{
//check numberArray[kk] > maxx
if(numberArray[kk]>maxx)
//set maxx to numberArray[kk]
maxx=numberArray[kk];
//check numberArray[kk]<minn
if(numberArray[kk]<minn)
//set minn to numberArray[kk]
minn=numberArray[kk];
}
//return range as the difference between maxx - minn
return maxx-minn;
}
I need some help on this assembly question, it has to be done strictly in Intel...
need help editing or rewriting java code, I have this program running that creates random numbers and finds min, max, median ect. from a group of numbers,array. I need to use a data class and a constructor to run the code instead of how I have it written right now. this is an example of what i'm being asked for. This is my code: import java.util.Random; import java.util.Scanner; public class RandomArray { // method to find the minimum number in...
Please help me with the code. Thank you! Description James Vond has delivered us some intel that the enemy perpetrators have been tricked into going to a bank that we've wired and booby-trapped. However, we have not gotten a bank system in place and you are the only person who is capable of handling such a task. We need this plan to go off without a hitch because the money we'll be receiving will give us insight on the hideout's...
Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...
Hi I need some help on this lab. The world depends on its successfull compilation. /* Lab5.java Arrays, File input and methods Read the comments and insert your code where indicated. Do not add/modify any output statements */ import java.io.*; import java.util.*; public class Lab5 { public static void main (String[] args) throws Exception { final int ARRAY_MAX = 30; // "args" is the list of tokens you put after "java Project3" on command line if (args.length == 0 )...
I have already finished most of this assignment. I just need some help with the canMove and main methods; pseudocode is also acceptable. Also, the programming language is java. Crickets and Grasshoppers is a simple two player game played on a strip of n spaces. Each space can be empty or have a piece. The first player plays as the cricket pieces and the other plays as grasshoppers and the turns alternate. We’ll represent crickets as C and grasshoppers as...
This is an assignment for my algorithm class which I have written the code partially and only need to complete it by adding a time function that calculates the average running time. We could use any programming language we want so I am using C++. I am including the instruction and my partial code below. Thank you! Implement linearSearch(a,key) and binarySearch( a,key)functions. Part A.In this part we will calculate theaverage-case running time of each function.1.Request the user to enter a...
I need help making this work correctly. I'm trying to do an array but it is drawing from a safeInput class that I am supposed to use from a previous lab. The safeInput class is located at the bottom of this question I'm stuck and it is not printing the output correctly. The three parts I think I am having most trouble with are in Bold below. Thanks in advance. Here are the parameters: Create a netbeans project called ArrayStuff...
I need a simple program in C language that calculates the values of Sine, Cosine, and Tangent of values given in degrees. It has to be a range of values between 0 and 360(integer values). The output should be a table of values showing Sin, Cos and Tan values. The complete computation and printing of the table must be done inside a function. The function also returns to the main program with 3 output arguments: It also needs to show...
*URGENT JAVA PROGRAMMING LAB* so I need to write some classes for my lab if someone could give me an outline or just how I should so it that would be awesom here is the questions please help ASAP A. A histogram is used to plot tabulated frequencies. Create a Histogram class that can be used to maintain and plot the frequencies of numbers that fall within a specified range. The Histogram class contain will an array of counters with...
This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated. The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...