Advertisement
InnaSibirova

syka

Dec 23rd, 2021
3,291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2. msg db "overflow"
  3. len equ $- msg
  4. minus db '-'
  5.  
  6. section .bss
  7. num1 resb 4
  8. num2 resb 4
  9. res2 resb 4
  10.  
  11. section .text
  12. global _start
  13. _start:
  14.  
  15. xor esi, esi
  16. xor edi, edi
  17.  
  18. A:
  19. mov eax, 3
  20. mov ebx, 0
  21. mov ecx, num1
  22. mov edx, 1
  23. int 0x80
  24.  
  25. mov eax, [num1]
  26. cmp eax, 45
  27. je minn
  28. cmp eax, '9'
  29. jg p1
  30. cmp eax, '0'
  31. jl p1
  32. sub eax, '0'
  33. push eax
  34. inc esi
  35. cmp esi, 8
  36. jg err
  37. jmp A
  38.  
  39. minn:
  40. mov edi, 1
  41. jmp A
  42.  
  43. p1:
  44. xor eax, eax
  45. xor ecx, ecx
  46.  
  47. conl:
  48. pop edx
  49. mov ebx, ecx
  50. cmp ecx, 0
  51. je n1
  52.  
  53. C:
  54. imul edx, 10
  55. dec ebx
  56. cmp ebx, 0
  57. jg C
  58.  
  59. n1:
  60. add eax, edx
  61. inc ecx
  62. cmp ecx, esi
  63. jl conl
  64. mov [num1], eax
  65. xor esi, esi
  66.  
  67. B:
  68. mov eax, 3
  69. mov ebx, 0
  70. mov ecx, num2
  71. mov edx, 1
  72. int 0x80
  73.  
  74. mov eax, [num2]
  75. cmp eax, '0'
  76. jl p2
  77. cmp eax, '9'
  78. jg p2
  79. sub eax, '0'
  80. push eax
  81. inc esi
  82. cmp esi, 8
  83. jg err
  84. jmp B
  85.  
  86. p2:
  87. xor eax, eax
  88. xor ecx, ecx
  89.  
  90. conll:
  91. pop edx
  92. mov ebx, ecx
  93. cmp ecx, 0
  94. je n2
  95.  
  96. D:
  97. imul edx, 10
  98. dec ebx
  99. cmp ebx, 0
  100. jg D
  101.  
  102. n2:
  103. add eax, edx
  104. inc ecx
  105. cmp ecx, esi
  106. jl conll
  107. mov [num2], eax
  108.  
  109. mov edx, 1
  110. mov ecx, [num2]
  111. mov eax, 1
  112. cmp ecx, 0
  113. je Y
  114.  
  115. L1:
  116. mov ebx, [num1]
  117. cmp ebx, 0
  118. je z
  119. cmp ebx, 1
  120. je Y
  121.  
  122. L2:
  123. add edx, eax
  124. jo err
  125. dec ebx
  126. cmp ebx, 1
  127. jg L2
  128. mov eax, edx
  129. dec ecx
  130. cmp ecx, 0
  131. jg L1
  132. jmp E
  133.  
  134. z:
  135. mov eax, 0
  136. jmp E
  137.  
  138. Y:
  139. mov eax, 1
  140. E:
  141. xor esi, esi
  142.  
  143. d:
  144. xor edx, edx
  145. mov ecx, 10
  146. div ecx
  147. push edx
  148. inc esi
  149. cmp eax, 0
  150. jne d
  151. cmp edi, 1
  152. jne drw
  153. mov eax, [num2]
  154. xor edx, edx
  155. mov ecx, 2
  156. div ecx
  157. cmp edx, 0
  158. je drw
  159. mov eax, 4
  160. mov ebx, 1
  161. mov ecx, minus
  162. mov edx, 1
  163. int 0x80
  164.  
  165. drw:
  166. pop edx
  167. add edx, '0'
  168. mov [res2], edx
  169. mov eax, 4
  170. mov ebx, 1
  171. mov ecx, res2
  172. mov edx, 1
  173. int 0x80
  174.  
  175. dec esi
  176. cmp esi, 0
  177. jg drw
  178. jmp aminb
  179.  
  180. err:
  181. mov eax, 4
  182. mov ebx, 1
  183. mov ecx, msg
  184. mov edx, len
  185. int 0x80
  186.  
  187. aminb:
  188. mov eax, 1
  189. mov ebx, 0
  190. int 0x80
  191.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement