Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.07 KB | None | 0 0
  1. .intel_syntax noprefix
  2. .text
  3. .global main
  4. main:
  5. push ebp
  6. mov ebp, esp
  7. call yolo00
  8. mov eax, 0
  9. mov esp,ebp
  10. pop ebp
  11. ret
  12. puti0:
  13. push ebp
  14. mov ebp, esp
  15. push edi
  16. push ebx
  17. push esi
  18. mov esi, DWORD PTR [ebp+16]
  19. push esi
  20. mov eax, OFFSET FLAT:printf_int
  21. push eax
  22. call printf
  23. add esp, 8
  24. pop esi
  25. pop ebx
  26. pop edi
  27. mov esp,ebp
  28. pop ebp
  29. ret
  30. putc0:
  31. push ebp
  32. mov ebp, esp
  33. push edi
  34. push ebx
  35. push esi
  36. mov esi, DWORD PTR [ebp+16]
  37. push esi
  38. mov eax, OFFSET FLAT:printf_char
  39. push eax
  40. call printf
  41. add esp, 8
  42. pop esi
  43. pop ebx
  44. pop edi
  45. mov esp,ebp
  46. pop ebp
  47. ret
  48. puts0:
  49. push ebp
  50. mov ebp, esp
  51. push edi
  52. push ebx
  53. push esi
  54. mov eax, DWORD PTR [ebp+16]
  55. push eax
  56. mov eax, OFFSET FLAT:printf_string
  57. push eax
  58. call printf
  59. add esp, 8
  60. pop esi
  61. pop ebx
  62. pop edi
  63. mov esp,ebp
  64. pop ebp
  65. ret
  66. geti0:
  67. push ebp
  68. mov ebp, esp
  69. push edi
  70. push ebx
  71. push esi
  72. mov eax, OFFSET FLAT:prompt_int
  73. push eax
  74. call printf
  75. add esp, 4
  76. mov eax, DWORD PTR [ebp+12]
  77. push eax
  78. mov eax, OFFSET FLAT:int_fmt
  79. push eax
  80. call scanf
  81. add esp, 8
  82. pop esi
  83. pop ebx
  84. pop edi
  85. mov esp,ebp
  86. pop ebp
  87. ret
  88. getc0:
  89. push ebp
  90. mov ebp, esp
  91. push edi
  92. push ebx
  93. push esi
  94. mov eax, OFFSET FLAT:prompt_char
  95. push eax
  96. call printf
  97. add esp, 4
  98. lea eax, DWORD PTR [ebp+12]
  99. push eax
  100. mov eax, OFFSET FLAT:char_fmt
  101. push eax
  102. call scanf
  103. add esp, 8
  104. pop esi
  105. pop ebx
  106. pop edi
  107. mov esp,ebp
  108. pop ebp
  109. ret
  110. gets0:
  111. push ebp
  112. push edi
  113. push ebx
  114. push esi
  115. push esi
  116. mov eax, DWORD PTR stdin
  117. push eax
  118. mov eax, DWORD PTR [ebp+16]
  119. push eax
  120. mov eax, DWORD PTR [ebp+20]
  121. push eax
  122. call fgets
  123. add esp, 12
  124. mov eax, DWORD PTR [ebp+12]
  125. push eax
  126. call strchr
  127. add esp, 8
  128. cmp eax, 0
  129. je grace_gets_no_newline
  130. mov BYTE PTR [eax], 0
  131. grace_gets_no_newline:
  132. pop esi
  133. pop ebx
  134. pop edi
  135. mov esp,ebp
  136. pop ebp
  137. ret
  138. abs0:
  139. push ebp
  140. mov ebp, esp
  141. push edi
  142. push ebx
  143. push esi
  144. mov eax, DWORD PTR [ebp+16]
  145. mov edx, 0
  146. cmp eax, edx
  147. jl abs_neg
  148. jmp abs_pos
  149. abs_neg:
  150. neg eax
  151. mov esi, DWORD PTR [ebp+12]
  152. mov DWORD PTR [esi], eax
  153. pop esi
  154. pop ebx
  155. pop edi
  156. mov esp,ebp
  157. pop ebp
  158. ret
  159. abs_pos:
  160. mov esi, DWORD PTR [ebp+12]
  161. mov DWORD PTR [esi], eax
  162. pop esi
  163. pop ebx
  164. pop edi
  165. mov esp,ebp
  166. pop ebp
  167. ret
  168. ord0:
  169. push ebp
  170. mov ebp, esp
  171. push edi
  172. push ebx
  173. push esi
  174. mov ebx, DWORD PTR [ebx+16]
  175. mov esi, DWORD PTR [ebp+12]
  176. mov DWORD PTR [esi], ebx
  177. pop esi
  178. pop ebx
  179. pop edi
  180. mov esp,ebp
  181. pop ebp
  182. ret
  183. chr0:
  184. push ebp
  185. mov ebp, esp
  186. push edi
  187. push ebx
  188. push esi
  189. mov ebx, DWORD PTR [ebx+16]
  190. mov esi, DWORD PTR [ebp+12]
  191. mov DWORD PTR [esi], ebx
  192. pop esi
  193. pop ebx
  194. pop edi
  195. mov esp,ebp
  196. pop ebp
  197. ret
  198. # 1:unit,yolo1,-,-
  199. yolo11:
  200. push ebp
  201. mov ebp, esp
  202. sub esp, 72
  203. push edi
  204. push ebx
  205. push esi
  206.  
  207. # 2:*,4,5,$1
  208. mov eax, 5
  209. mov ecx, 4
  210. imul ecx
  211. mov DWORD PTR [ebp-4], eax
  212.  
  213. # 3:+,base,$1,$2
  214. mov eax, DWORD PTR [ebp-4]
  215. mov edx, 0
  216. add eax, edx
  217. mov DWORD PTR [ebp-8], eax
  218.  
  219. # 4:+,$2,4,$3
  220. mov eax, 4
  221. mov edx, DWORD PTR [ebp-8]
  222. add eax, edx
  223. mov DWORD PTR [ebp-12], eax
  224.  
  225. # 5:array,x,$3,$4
  226. mov eax, DWORD PTR [ebp-12]
  227. mov ecx, 4
  228. imul ecx
  229. mov esi, DWORD PTR [ebp+16]
  230. lea ecx, DWORD PTR [esi]
  231. add eax, ecx
  232. mov DWORD PTR [ebp-16], eax
  233.  
  234. # 6::=,5,-,[$4]
  235. mov ecx, 5
  236. mov edi, DWORD PTR [ebp-16]
  237. mov DWORD PTR [edi], ecx
  238.  
  239. # 7:*,4,5,$5
  240. mov eax, 5
  241. mov ecx, 4
  242. imul ecx
  243. mov DWORD PTR [ebp-20], eax
  244.  
  245. # 8:+,base,$5,$6
  246. mov eax, DWORD PTR [ebp-20]
  247. mov edx, 0
  248. add eax, edx
  249. mov DWORD PTR [ebp-24], eax
  250.  
  251. # 9:+,$6,4,$7
  252. mov eax, 4
  253. mov edx, DWORD PTR [ebp-24]
  254. add eax, edx
  255. mov DWORD PTR [ebp-28], eax
  256.  
  257. # 10:array,x,$7,$8
  258. mov eax, DWORD PTR [ebp-28]
  259. mov ecx, 4
  260. imul ecx
  261. mov esi, DWORD PTR [ebp+16]
  262. lea ecx, DWORD PTR [esi]
  263. add eax, ecx
  264. mov DWORD PTR [ebp-32], eax
  265.  
  266. # 11:par,[$8],V,-
  267. mov edi, DWORD PTR [ebp-32]
  268. mov eax, DWORD PTR [edi]
  269. push eax
  270.  
  271. # 12:call,-,-,puti
  272. push eax
  273. mov esi,DWORD PTR [ebp+8]
  274. push esi
  275. call puti0
  276. add esp, 12
  277.  
  278. # 13::=,3,-,seed
  279. mov ecx, 3
  280. mov esi, DWORD PTR [ebp+8]
  281. mov DWORD PTR [esi-4], ecx
  282.  
  283. # 14:+,3,seed,$9
  284. mov esi, DWORD PTR [ebp+8]
  285. mov eax, DWORD PTR [esi-4]
  286. mov edx, 3
  287. add eax, edx
  288. mov DWORD PTR [ebp-36], eax
  289.  
  290. # 15:*,4,5,$10
  291. mov eax, 5
  292. mov ecx, 4
  293. imul ecx
  294. mov DWORD PTR [ebp-40], eax
  295.  
  296. # 16:+,base,$10,$11
  297. mov eax, DWORD PTR [ebp-40]
  298. mov edx, 0
  299. add eax, edx
  300. mov DWORD PTR [ebp-44], eax
  301.  
  302. # 17:+,$11,4,$12
  303. mov eax, 4
  304. mov edx, DWORD PTR [ebp-44]
  305. add eax, edx
  306. mov DWORD PTR [ebp-48], eax
  307.  
  308. # 18:array,x,$12,$13
  309. mov eax, DWORD PTR [ebp-48]
  310. mov ecx, 4
  311. imul ecx
  312. mov esi, DWORD PTR [ebp+16]
  313. lea ecx, DWORD PTR [esi]
  314. add eax, ecx
  315. mov DWORD PTR [ebp-52], eax
  316.  
  317. # 19:+,[$13],$9,$14
  318. mov eax, DWORD PTR [ebp-36]
  319. mov edi, DWORD PTR [ebp-52]
  320. mov edx, DWORD PTR [edi]
  321. add eax, edx
  322. mov DWORD PTR [ebp-56], eax
  323.  
  324. # 20::=,[$14],-,seed
  325. mov edi, DWORD PTR [ebp-56]
  326. mov ecx, DWORD PTR [edi]
  327. mov esi, DWORD PTR [ebp+8]
  328. mov DWORD PTR [esi-4], ecx
  329.  
  330. # 21:par,seed,V,-
  331. mov esi, DWORD PTR [ebp+8]
  332. mov eax, DWORD PTR [esi-4]
  333. push eax
  334.  
  335. # 22:call,-,-,puti
  336. push eax
  337. mov esi,DWORD PTR [ebp+8]
  338. push esi
  339. call puti0
  340. add esp, 12
  341.  
  342. # 23:*,4,5,$15
  343. mov eax, 5
  344. mov ecx, 4
  345. imul ecx
  346. mov DWORD PTR [ebp-60], eax
  347.  
  348. # 24:+,base,$15,$16
  349. mov eax, DWORD PTR [ebp-60]
  350. mov edx, 0
  351. add eax, edx
  352. mov DWORD PTR [ebp-64], eax
  353.  
  354. # 25:+,$16,4,$17
  355. mov eax, 4
  356. mov edx, DWORD PTR [ebp-64]
  357. add eax, edx
  358. mov DWORD PTR [ebp-68], eax
  359.  
  360. # 26:array,x,$17,$18
  361. mov eax, DWORD PTR [ebp-68]
  362. mov ecx, 4
  363. imul ecx
  364. mov esi, DWORD PTR [ebp+16]
  365. lea ecx, DWORD PTR [esi]
  366. add eax, ecx
  367. mov DWORD PTR [ebp-72], eax
  368.  
  369. # 27::=,[$18],-,$$
  370. mov edi, DWORD PTR [ebp-72]
  371. mov ecx, DWORD PTR [edi]
  372. mov esi, DWORD PTR [ebp+12]
  373. mov DWORD PTR [esi], ecx
  374.  
  375. # 28:RET,-,-,-
  376. pop esi
  377. pop ebx
  378. pop edi
  379. add esp, 72
  380. pop ebp
  381. ret
  382.  
  383. # 29:endu,yolo1,-,-
  384. pop esi
  385. pop ebx
  386. pop edi
  387. add esp, 72
  388. pop ebp
  389. ret
  390.  
  391. # 30:unit,yolo0,-,-
  392. yolo00:
  393. push ebp
  394. mov ebp, esp
  395. sub esp, 180
  396. push edi
  397. push ebx
  398. push esi
  399.  
  400.  
  401. # 32:par,i,V,-
  402. mov eax, DWORD PTR [ebp-8]
  403. push eax
  404.  
  405. # 31:par,x,R,-
  406. lea esi, DWORD PTR [ebp-108]
  407. push esi
  408.  
  409. # 34:call,-,-,yolo1
  410. # 33:par,$19,RET,-
  411. lea esi, DWORD PTR [ebp-128]
  412. push esi
  413. push ebp
  414. call yolo11
  415. add esp, 12
  416.  
  417.  
  418. # 36:par,seed,V,-
  419. mov eax, DWORD PTR [ebp-4]
  420. push eax
  421.  
  422. # 35:par,x,R,-
  423. lea esi, DWORD PTR [ebp-108]
  424. push esi
  425.  
  426. # 38:call,-,-,yolo1
  427. # 37:par,$20,RET,-
  428. lea esi, DWORD PTR [ebp-132]
  429. push esi
  430. push ebp
  431. call yolo11
  432. add esp, 12
  433.  
  434. # 39:+,$20,15,$21
  435. mov eax, 15
  436. mov edx, DWORD PTR [ebp-132]
  437. add eax, edx
  438. mov DWORD PTR [ebp-136], eax
  439.  
  440. # 40::=,$21,-,seed
  441. mov ecx, DWORD PTR [ebp-136]
  442. mov DWORD PTR [ebp-4], ecx
  443.  
  444. # 41:par,seed,V,-
  445. mov eax, DWORD PTR [ebp-4]
  446. push eax
  447.  
  448. # 42:call,-,-,puti
  449. push eax
  450. push DWORD PTR [ebp+8]
  451. call puti0
  452. add esp, 12
  453.  
  454.  
  455. # 44:call,-,-,geti
  456. # 43:par,$22,RET,-
  457. lea esi, DWORD PTR [ebp-140]
  458. push esi
  459. push DWORD PTR [ebp+8]
  460. call geti0
  461. add esp, 4
  462.  
  463. # 45::=,$22,-,seed
  464. mov ecx, DWORD PTR [ebp-140]
  465. mov DWORD PTR [ebp-4], ecx
  466.  
  467. # 46:par,seed,V,-
  468. mov eax, DWORD PTR [ebp-4]
  469. push eax
  470.  
  471. # 47:call,-,-,puti
  472. push eax
  473. push DWORD PTR [ebp+8]
  474. call puti0
  475. add esp, 12
  476.  
  477. # 48:uminus,5,-,$23
  478. mov eax, 5
  479. neg eax
  480. mov DWORD PTR [ebp-144], eax
  481.  
  482. # 49::=,$23,-,seed
  483. mov ecx, DWORD PTR [ebp-144]
  484. mov DWORD PTR [ebp-4], ecx
  485.  
  486. # 50:par,seed,V,-
  487. mov eax, DWORD PTR [ebp-4]
  488. push eax
  489.  
  490. # 51:call,-,-,puti
  491. push eax
  492. push DWORD PTR [ebp+8]
  493. call puti0
  494. add esp, 12
  495.  
  496.  
  497. # 52:par,seed,V,-
  498. mov eax, DWORD PTR [ebp-4]
  499. push eax
  500.  
  501. # 54:call,-,-,abs
  502. # 53:par,$24,RET,-
  503. lea esi, DWORD PTR [ebp-148]
  504. push esi
  505. push DWORD PTR [ebp+8]
  506. call abs0
  507. add esp, 8
  508.  
  509. # 55::=,$24,-,seed
  510. mov ecx, DWORD PTR [ebp-148]
  511. mov DWORD PTR [ebp-4], ecx
  512.  
  513. # 56:par,seed,V,-
  514. mov eax, DWORD PTR [ebp-4]
  515. push eax
  516.  
  517. # 57:call,-,-,puti
  518. push eax
  519. push DWORD PTR [ebp+8]
  520. call puti0
  521. add esp, 12
  522.  
  523.  
  524. # 58:par,seed,V,-
  525. mov eax, DWORD PTR [ebp-4]
  526. push eax
  527.  
  528. # 60:call,-,-,abs
  529. # 59:par,$25,RET,-
  530. lea esi, DWORD PTR [ebp-152]
  531. push esi
  532. push DWORD PTR [ebp+8]
  533. call abs0
  534. add esp, 8
  535.  
  536. # 61:par,$25,V,-
  537. mov eax, DWORD PTR [ebp-152]
  538. push eax
  539.  
  540. # 62:call,-,-,puti
  541. push eax
  542. push DWORD PTR [ebp+8]
  543. call puti0
  544. add esp, 12
  545.  
  546.  
  547. # 63:par,'c',V,-
  548. mov eax, OFFSET FLAT:string1
  549. push eax
  550.  
  551. # 65:call,-,-,ord
  552. # 64:par,$26,RET,-
  553. lea esi, DWORD PTR [ebp-156]
  554. push esi
  555. push DWORD PTR [ebp+8]
  556. call ord0
  557. add esp, 8
  558.  
  559. # 66::=,$26,-,seed
  560. mov ecx, DWORD PTR [ebp-156]
  561. mov DWORD PTR [ebp-4], ecx
  562.  
  563. # 67:par,seed,V,-
  564. mov eax, DWORD PTR [ebp-4]
  565. push eax
  566.  
  567. # 68:call,-,-,puti
  568. push eax
  569. push DWORD PTR [ebp+8]
  570. call puti0
  571. add esp, 12
  572.  
  573.  
  574. # 69:par,'c',V,-
  575. mov eax, OFFSET FLAT:string2
  576. push eax
  577.  
  578. # 71:call,-,-,ord
  579. # 70:par,$27,RET,-
  580. lea esi, DWORD PTR [ebp-160]
  581. push esi
  582. push DWORD PTR [ebp+8]
  583. call ord0
  584. add esp, 8
  585.  
  586. # 72:par,$27,V,-
  587. mov eax, DWORD PTR [ebp-160]
  588. push eax
  589.  
  590. # 73:call,-,-,puti
  591. push eax
  592. push DWORD PTR [ebp+8]
  593. call puti0
  594. add esp, 12
  595.  
  596. # 74:-,3,seed,$28
  597. mov eax, DWORD PTR [ebp-4]
  598. mov edx, 3
  599. sub eax, edx
  600. mov DWORD PTR [ebp-164], eax
  601.  
  602. # 75::=,$28,-,seed
  603. mov ecx, DWORD PTR [ebp-164]
  604. mov DWORD PTR [ebp-4], ecx
  605.  
  606. # 76:par,seed,V,-
  607. mov eax, DWORD PTR [ebp-4]
  608. push eax
  609.  
  610. # 77:call,-,-,puti
  611. push eax
  612. push DWORD PTR [ebp+8]
  613. call puti0
  614. add esp, 12
  615.  
  616. # 78:*,5,seed,$29
  617. mov eax, DWORD PTR [ebp-4]
  618. mov ecx, 5
  619. imul ecx
  620. mov DWORD PTR [ebp-168], eax
  621.  
  622. # 79::=,$29,-,seed
  623. mov ecx, DWORD PTR [ebp-168]
  624. mov DWORD PTR [ebp-4], ecx
  625.  
  626. # 80:par,seed,V,-
  627. mov eax, DWORD PTR [ebp-4]
  628. push eax
  629.  
  630. # 81:call,-,-,puti
  631. push eax
  632. push DWORD PTR [ebp+8]
  633. call puti0
  634. add esp, 12
  635.  
  636. # 82:%,5,seed,$30
  637. mov eax, DWORD PTR [ebp-4]
  638. cdq
  639. mov ecx, 5
  640. idiv ecx
  641. mov DWORD PTR [ebp-172], edx
  642.  
  643. # 83::=,$30,-,seed
  644. mov ecx, DWORD PTR [ebp-172]
  645. mov DWORD PTR [ebp-4], ecx
  646.  
  647. # 84:par,seed,V,-
  648. mov eax, DWORD PTR [ebp-4]
  649. push eax
  650.  
  651. # 85:call,-,-,puti
  652. push eax
  653. push DWORD PTR [ebp+8]
  654. call puti0
  655. add esp, 12
  656.  
  657. # 86:/,5,seed,$31
  658. mov eax, DWORD PTR [ebp-4]
  659. cdq
  660. mov ecx, 5
  661. idiv ecx
  662. mov DWORD PTR [ebp-176], eax
  663.  
  664. # 87::=,$31,-,seed
  665. mov ecx, DWORD PTR [ebp-176]
  666. mov DWORD PTR [ebp-4], ecx
  667.  
  668. # 88:par,seed,V,-
  669. mov eax, DWORD PTR [ebp-4]
  670. push eax
  671.  
  672. # 89:call,-,-,puti
  673. push eax
  674. push DWORD PTR [ebp+8]
  675. call puti0
  676. add esp, 12
  677.  
  678. # 90:uminus,5,-,$32
  679. mov eax, 5
  680. neg eax
  681. mov DWORD PTR [ebp-180], eax
  682.  
  683. # 91::=,$32,-,seed
  684. mov ecx, DWORD PTR [ebp-180]
  685. mov DWORD PTR [ebp-4], ecx
  686.  
  687. # 92:par,seed,V,-
  688. mov eax, DWORD PTR [ebp-4]
  689. push eax
  690.  
  691. # 93:call,-,-,puti
  692. push eax
  693. push DWORD PTR [ebp+8]
  694. call puti0
  695. add esp, 12
  696.  
  697. # 94:endu,yolo0,-,-
  698. pop esi
  699. pop ebx
  700. pop edi
  701. add esp, 180
  702. pop ebp
  703. ret
  704.  
  705.  
  706. .data
  707. string1: .asciz "c"
  708. string2: .asciz "c"
  709. int_fmt: .asciz "%d"
  710. char_fmt: .asciz "%c"
  711. string_fmt: .asciz "%c\n"
  712. printf_int: .asciz "%d\n"
  713. printf_char: .asciz "%c\n"
  714. printf_string: .asciz "%s\n"
  715. prompt_int: .asciz "Enter a number\n"
  716. prompt_char: .asciz "Enter a character\n"
  717. prompt_string: .asciz "Enter a string"
  718. prompt_string2: .asciz "with length %d characters\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement