Question: Assembly language How to find the max and min between 3 ints. Here is what I have ------------------------------------------------------------------------------- void minMax(int a, int b, int c,
Assembly language
How to find the max and min between 3 ints. Here is what I have
-------------------------------------------------------------------------------
void minMax(int a, int b, int c, int *result) { __asm {
mov esi, result
mov eax, a mov ebx, b mov ecx, c
// YOUR CODE STARTS HERE // Find larger of a and b mov edx, eax cmp ebx, edx jle FindMax1 mov edx, ebx
FindMax1:
//Find larger of a or b and c; Max is stored in edx cmp ecx, edx jle FindMax2 mov edx, ecx
FindMax2 :
//Find smaller of a and b cmp ebx, eax jge FindMin1 mov eax, ebx
FindMin1 :
//Find smaller of a or b and c; Min is stored in eax cmp ecx, eax jge FindMin2 mov eax, ecx
FindMin2 :
//Add Min and Max and store in eax; multiply eax by 2017 add eax, edx // YOUR CODE ENDS HERE
mov [esi][0], eax }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
