Now that we have the procedure converted to a list of ret, assign instructions, it might be nice, if we convert this to real pascal code.
First some requirements for the proc:
First we will generate a list of register which is read before they are set, and a list of register which is used.
Then we also require that only eax, ecx and edx are used.
If ecx is read before set eax, edx and ecx are params, if edx is read before set eax, edx are params, if eax is read before set eax is the only param, otherwise there are no params.
If ecx is used ecx, edx and eax are params if edx is used edx and eax are params, if eax is used eax is the only param, otherwise if eax is totally not used, then eax is a param otherwise there are no params.
We create vars for all registers which are used but are not params.
Now that every used register has a parameter or var, we convert every assign instruction into pascal using the names of the parameter or var and we have to find a pascal equivalents for every other operations/instructions (const, pointer, *, div, etc).
Therefor we also require that there is not a address value references which is also fixup