Convert c into assembly code I do not need the setup to actu
Convert c++ into assembly code:
I do not need the setup to actually run it as a program, just need the equivelant for the following lines.
Write the assembly level program for the following if (a10) else a [21++ if (a [2] != 0) Assume 1. 2. Base address of integer array a is stored in % esp The value of i is available in %Solution
Solution:
Equialent assembly code:
mov( a[1], esp); //move the value of array[1] value to esp
 
        cmp( esp, 0 ); //comparing the value of esp with \'0\'
   
 jne ELSE; //jump not equal to the label called \'ELSE\'
 
        inc (a[2)]); //incremenent the value of array value a[2]
 
        jmp ENDOFIF; //jump to the ENDOFIF label
ELSE: mov (a[2],esp[1]); //move array of value[2] to esp[1]
cmp (esp[1], 0 ); //comparing the value of esp[1] with \'0\'
je ENDOFIF; //jump equal to ENDOFIF label
mov (i,ecx) //move the value of ecx to i
 
 add esp[1])+ecx //add the value of esp[1] with ecx
inc (a[ecx+1]) //incremenent the value of a[ecx+1]
ENDOFIF: //END OF IF statement.
   

