Calculate proc
...
ret
Calculate endp
int Calculate(int x, int n) { __asm { mov eax, x mov ecx, n mov ebx, 0 for: push eax imul eax, ecx imul eax, 2 add ebx, eax pop eax loop for mov eax, ebx } } void main() { int s = Calculate(2, 2); cout << "Result=" << s; }