Guest User

Untitled

a guest
Jan 24th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. int foo() {
  2. volatile int i = 0; // force it to be stored to memory
  3. return i;
  4. }
  5.  
  6. ;;; MSVC -O2
  7. _i$ = -4 ; size = 4
  8. int foo(void) PROC ; foo, COMDAT
  9. push ecx
  10. mov DWORD PTR _i$[esp+4], 0 ; note this is actually [esp+0] ; _i$ = -4
  11. mov eax, DWORD PTR _i$[esp+4]
  12. pop ecx
  13. ret 0
  14. int foo(void) ENDP ; foo
  15.  
  16. ;;; MSVC -O0
  17. _i$ = -4 ; size = 4
  18. int foo(void) PROC ; foo
  19. push ebp
  20. mov ebp, esp ; make a stack frame
  21. push ecx
  22. mov DWORD PTR _i$[ebp], 0
  23. mov eax, DWORD PTR _i$[ebp]
  24. mov esp, ebp
  25. pop ebp
  26. ret 0
  27. int foo(void) ENDP ; foo
Add Comment
Please, Sign In to add comment