Assembly Code:
test ecx,ecx; // Check If Zero
jnz @@Continue; //IF it is not Zero Go to @@Continue, Else go on
mov eax,edx; //Put second paramater as result
ret; //Return
@@Continue:
test edx,edx; //Begin of while loop
jz @@Wend; // If second paramater is zero go to the end
cmp ecx,eax; // Compare First and second paramater
jnb @@Lower; //If First > second then go to @@Lower
jmp @@Higher; //Else go to higher
@@Lower:
sub ecx,edx; // first = first - second
jmp @@Continue; // next iteration of while loop
@@Higher:
sub edx,ecx; // second = second - first
jmp @@Continue;// next iteration of while loop
@@Wend: //While loop ended, need to return value.
mov eax,ecx;