[EXERCISE 0002] Simple manual decompilation exercise for beginners – Part 2

Your goal is to analyse the following compiler-generated assembly language code and understand how it works. It contains a very simple loop.

...
mov dword ptr [esi], 1
xor edx, edx
mov [ebx], edx
jmp short loc_4012F1
loc_4012E8:
mov ecx, [esi]
imul ecx, [esi]
mov [esi], ecx
inc dword ptr [ebx]
loc_4012F1:
cmp dword ptr [ebx], 8
jl short loc_4012E8
...

You must retrieve the proper C/C++ code or pseudo code of this commented procedure. Your solution has to contain either a full commented C/C++ code or a detailed pseudo code describing the function of the above snippet.