IANAAP (I Am Not An Assember Programmer) but, some thoughts:
Feels like there is as many ways to write assembler as there are assemblers thought... What is the problem ?
Argh, whats up with the k variable in the c++ example (not declared) ? and counting goes in different directions (down in asm, up in c++)
What you do seem to be doing is to set edx to 2 and count down to zero, that cant be right... (Edit seems you are counting both edx and k up at the end, first edx - 1 + 1 each round, and k = 0 + 1 each round... I got a head ache right now so now I'll stop reading this)
Even worse you loop through the loop initation all the time (LL)...
(this looks odd)
mov eax, tmpA
mov eax, CO[esi] And where did the swap/save between tmpA and tmpB go ?
And I have no idea about the included functions, do they preserv all registers, what arguments do they take, and so on...