daily pastebin goal
60%
SHARE
TWEET

ex 1 laborator 10

a guest Jan 22nd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "pch.h"
  2. #include <stdio.h>
  3.  
  4. int f(int n)
  5. {
  6.   _asm {
  7.     mov ebx, [ebp + 8]
  8.     shl ebx, 1
  9.     mov ecx, 2
  10.     mov esi, 1
  11.     mov edi, 0
  12.     while1:
  13.     cmp ecx, ebx
  14.     jg stopwhile1
  15.     mov eax, esi
  16.     mul ecx
  17.     mov esi, eax
  18.     add edi, esi
  19.     inc ecx
  20.     inc ecx
  21.     jmp while1
  22.     stopwhile1:
  23.     mov eax, edi
  24.   }
  25. }
  26.  
  27. int main()
  28. {
  29.   int rez = 0;
  30.   _asm {
  31.     push 3;
  32.     call f
  33.     add esp, 4
  34.     mov rez, eax
  35.   }
  36.  
  37.   printf("%d\n", rez);
  38.  
  39.   return 0;
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top