Assume that we execute this function with the following inputs: Given: arrayOfLetters[3] = {A????1eA

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Order a Similar Paper Order a Different Paper

Assume that we execute this function with the following inputs:

Given:                          arrayOfLetters[3] = {A????1eA????1, A????1dA????1, A????1fA????1} with address 0x1234ABCD

                                  resultArray[3] (empty) with address 0x12345678

ASCII values:              a = 0x61, b = 0x62, c = 0x63, d = 0x64, e = 0x65, f = 0x66 A????1

Initial function call:        functionHW3( arrayOfLetters, resultArray, 3, 2 )

[ Note: 0x indicates a hexadecimal number ]

__declspec(naked)

void functionHW3( char arrayOfLetters[], char resultArray[], int len, int n )

{

         __asm{

0               push   ebp

1               mov   ebp, esp

2

3                     push    ebx

4                     push    esi

5                     push    edi

6

7                    mov    ebx, [ebp+8]   

8                     mov     edi, [ebp+12]      

9                     mov     edx, n     

10                   mov     esi, 0

11        START_LOOP:

12                   cmp     esi, len

13                   jge   END

14

15               mov     ecx, ebx

16               add   ecx, esi

17

18               push   ecx

19               push   edx

20

21                   push    edx

22                   push    ecx

23      

24                   call   functionArray

25                  

26               (1)_______________________

27

28               pop   edx

29               pop   ecx

30

31                   mov     byte ptr[edi+esi], al

32                   inc   esi

33                   jmp     START_LOOP

34           END:

35

36               (2)_______________________

37                     (3)_______________________

38                     (4)_______________________

39

40               pop   ebp

41

42               ret

          }

  }

  __declspec(naked)     

  char functionArray( char* input_char, int n )

  {

          __asm{

                  push   ebp

               mov   ebp, esp    

               (5)_______________________

                 mov   edx, 0

                 mov   edx, dword ptr[ebp + 8]

               mov   edx, [edx]

                 mov   esi, dword ptr[ebp + 12]

               sub   edx, esi

                 (6)_______________________

               (7)_______________________

               (8)_______________________

               (9)_______________________

  

          }

  }

Write the correct assembly instructions from (1) to (9):

Number

Assembly Instruction

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(9)

Write the values in the stack as the execution of this program reaches line 25 in functionHW3( ) for the first time. Discard the call stack of the caller of functionHW3( ).

Address

Value

ESP

For Address, use ESP to point to the top and ESP + offset for the rest

For unknown values, use mnemonics such as register name or address of A????1

What are the values in resultArray[] after this function is called and completes execution?

Value (in letter)

resultArray[0]

resultArray[1]

resultArray[2]