Advertisement
Guest User

Untitled

a guest
Sep 17th, 2020
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int foo = 1;
  4. char bar[] = "Яблоко";
  5.  
  6. asm(
  7. "_asm_function:         \n"
  8. "                       \n"
  9. "   push %ebp           \n"
  10. "   mov  %esp, %ebp     \n"
  11. "                       \n"
  12. "   mov  _foo, %eax     \n"
  13. "   add  %eax, _bar     \n"
  14. "   add  $1, _foo       \n"
  15. "                       \n"
  16. "   push $_bar          \n"
  17. "   call _puts          \n"
  18. "                       \n"
  19. "   mov  %ebp, %esp     \n"
  20. "   pop  %ebp           \n"
  21. "   ret                 \n"
  22. );
  23. extern "C" void asm_function();
  24.  
  25. int main()
  26. {
  27.     asm_function();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement