Multiplying numbers using pointers
•[ebx] := [ebx] * 2
•Means multiply contents of the memory whose address is stored in ebx by 2
•
•In C language we write:
•*b =  *b * 2; or *b *= 2;
•
•In Assembler we use instruction imul (integer multiply)
•imul [ebx]
•Means [ebx] := [ebx] * eax, so we have to put 2 into eax, but we already have 1 in eax so we use inc eax before imul to increment by 1
•Result of multiplication is put into registers eax only! This is because the compiler recognized that we multiply small numbers.
•
•In WinDbg disassembly output we see:
•00411a44 40               inc     eax
•00411a45 f62b             imul    byte ptr [ebx]
•00411a47 8903             mov     [ebx],eax