Advertisement
kokokozhina

func

Apr 6th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;with ebx instead of edx works correctly
  2. section .data
  3. fmt: db "%d", 0
  4. zero: dd 0
  5. two: dd 2
  6. ten: dd 10
  7. seven: dd 7
  8. three: dd 3
  9.  
  10. section .bss
  11. x: resd 1
  12. t: resd 1
  13.  
  14. section .text
  15. extern _scanf
  16. extern _printf
  17. global _lab1
  18. global _lab2
  19. global _lab3
  20. global _main
  21.  
  22. _main:
  23. push x
  24. push fmt
  25. call _scanf
  26. add esp, 8
  27. mov eax, [x]
  28. cmp eax, [zero]
  29. jl _lab1
  30. mul dword [x]
  31. mul dword [two]
  32. mov [t], eax
  33. mov eax, [x]
  34. mul dword [three]
  35. sub [t], eax
  36. mov eax, [ten]
  37. add [t], eax
  38. mov eax, [t]
  39. jmp _lab2
  40.  
  41. _lab1:
  42. mul dword [x]
  43. mul dword [x]
  44. sub eax, [seven]
  45.  
  46. _lab2:
  47. mov [x], eax
  48. push dword [x]
  49. push fmt
  50. call _printf
  51. add esp, 8
  52. xor eax, eax
  53. xor ecx, ecx
  54. xor edx, edx
  55. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement