Guest User

Untitled

a guest
Dec 16th, 2016
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int div64(int hi, int lo, int divisor, int *premainder)
  2. {
  3. __asm
  4. {
  5. mov edx, DWORD PTR [hi];
  6. mov eax, DWORD PTR [lo];
  7. idiv DWORD PTR [divisor]
  8. mov ecx, DWORD PTR [premainder]
  9. mov DWORD PTR [ecx], edx
  10. }
  11. }
  12.  
  13. int Test(int hi, int lo, int divisor)
  14. {
  15. int remainder;
  16. return div64(hi, lo, divisor, &remainder);
  17. }
  18.  
  19. ---------------
  20.  
  21. PUBLIC ?div64@@YGHHHHPAH@Z ; div64
  22. _TEXT SEGMENT
  23. _hi$ = 8 ; size = 4
  24. _lo$ = 12 ; size = 4
  25. _divisor$ = 16 ; size = 4
  26. _premainder$ = 20 ; size = 4
  27. ?div64@@YGHHHHPAH@Z PROC ; div64, COMDAT
  28. mov edx, DWORD PTR _hi$[esp-4]
  29. mov eax, DWORD PTR _lo$[esp-4]
  30. idiv DWORD PTR _divisor$[esp-4]
  31. mov ecx, DWORD PTR _premainder$[esp-4]
  32. mov DWORD PTR [ecx], edx
  33. ret 16
  34. ?div64@@YGHHHHPAH@Z ENDP ; div64
  35. _TEXT ENDS
  36.  
  37. PUBLIC ?Test@@YGHHHH@Z ; Test
  38. _TEXT SEGMENT
  39. _remainder$ = -8 ; size = 4
  40. $T70693 = -4 ; size = 4
  41. _hi$ = 8 ; size = 4
  42. _lo$ = 12 ; size = 4
  43. _divisor$ = 16 ; size = 4
  44. ?Test@@YGHHHH@Z PROC ; Test, COMDAT
  45. sub esp, 8
  46. lea eax, DWORD PTR _remainder$[esp+8]
  47. mov DWORD PTR $T70693[esp+8], eax
  48. mov edx, DWORD PTR _hi$[esp+4]
  49. mov eax, DWORD PTR _lo$[esp+4]
  50. idiv DWORD PTR _divisor$[esp+4]
  51. mov ecx, DWORD PTR $T70693[esp+8]
  52. mov DWORD PTR [ecx], edx
  53. add esp, 8
  54. ret 12
  55. ?Test@@YGHHHH@Z ENDP ; Test
  56. _TEXT ENDS
RAW Paste Data