yolila

cl /Ox

Oct 8th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.19 KB | None | 0 0
  1. ; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01
  2.  
  3. TITLE F:\WKSPS\C\d.c
  4. .686P
  5. .XMM
  6. include listing.inc
  7. .model flat
  8.  
  9. INCLUDELIB LIBCMT
  10. INCLUDELIB OLDNAMES
  11.  
  12. _DATA SEGMENT
  13. $SG81286 DB '%u', 00H
  14. ORG $+1
  15. $SG81293 DB 'i=%u', 09H, 'sum(i)=%e', 09H, 'time consuming=%ldns', 0aH
  16. DB 00H
  17. _DATA ENDS
  18. PUBLIC _get_cpu_time
  19. EXTRN __imp__QueryPerformanceCounter@4:PROC
  20. EXTRN __imp__QueryPerformanceFrequency@4:PROC
  21. EXTRN __alldiv:PROC
  22. EXTRN __allmul:PROC
  23. _BSS SEGMENT
  24. ?li@?1??get_cpu_time@@9@9 DQ 01H DUP (?) ; `get_cpu_time'::`2'::li
  25. ; Function compile flags: /Ogtpy
  26. _BSS ENDS
  27. _TEXT SEGMENT
  28. _linow$ = -8 ; size = 8
  29. _get_cpu_time PROC
  30. ; File f:\wksps\c\d.c
  31. ; Line 5
  32. sub esp, 8
  33. push esi
  34. ; Line 8
  35. xor esi, esi
  36. ; Line 10
  37. push OFFSET ?li@?1??get_cpu_time@@9@9
  38. mov DWORD PTR _linow$[esp+16], esi
  39. mov DWORD PTR _linow$[esp+20], esi
  40. mov DWORD PTR ?li@?1??get_cpu_time@@9@9, esi
  41. mov DWORD PTR ?li@?1??get_cpu_time@@9@9+4, esi
  42. call DWORD PTR __imp__QueryPerformanceFrequency@4
  43. ; Line 11
  44. lea eax, DWORD PTR _linow$[esp+12]
  45. push eax
  46. call DWORD PTR __imp__QueryPerformanceCounter@4
  47. ; Line 12
  48. mov ecx, DWORD PTR _linow$[esp+16]
  49. mov edx, DWORD PTR _linow$[esp+12]
  50. push esi
  51. push 1000000000 ; 3b9aca00H
  52. push ecx
  53. push edx
  54. call __allmul
  55. mov ecx, DWORD PTR ?li@?1??get_cpu_time@@9@9+4
  56. push ecx
  57. mov ecx, DWORD PTR ?li@?1??get_cpu_time@@9@9
  58. push ecx
  59. push edx
  60. push eax
  61. call __alldiv
  62. pop esi
  63. ; Line 13
  64. add esp, 8
  65. ret 0
  66. _get_cpu_time ENDP
  67. _TEXT ENDS
  68. PUBLIC __real@3ff0000000000000
  69. PUBLIC __real@41f0000000000000
  70. PUBLIC _recursion_factorial
  71. EXTRN __fltused:DWORD
  72. ; COMDAT __real@3ff0000000000000
  73. CONST SEGMENT
  74. __real@3ff0000000000000 DQ 03ff0000000000000r ; 1
  75. CONST ENDS
  76. ; COMDAT __real@41f0000000000000
  77. CONST SEGMENT
  78. __real@41f0000000000000 DQ 041f0000000000000r ; 4.29497e+009
  79. ; Function compile flags: /Ogtpy
  80. CONST ENDS
  81. _TEXT SEGMENT
  82. tv129 = 8 ; size = 4
  83. _n$ = 8 ; size = 4
  84. _recursion_factorial PROC
  85. ; Line 16
  86. push esi
  87. ; Line 17
  88. mov esi, DWORD PTR _n$[esp]
  89. cmp esi, 1
  90. je SHORT $LN2@recursion_
  91. test esi, esi
  92. je SHORT $LN2@recursion_ ;; term condi end
  93. ; Line 20
  94. lea eax, DWORD PTR [esi-1]
  95. push eax
  96. call _recursion_factorial ;; sub recur end
  97. add esp, 4
  98. mov DWORD PTR tv129[esp], esi
  99. fild DWORD PTR tv129[esp] ;; type coercion
  100. test esi, esi
  101. jns SHORT $LN6@recursion_
  102. fadd QWORD PTR __real@41f0000000000000
  103. $LN6@recursion_:
  104. fmulp ST(1), ST(0)
  105. pop esi
  106. ; Line 21
  107. ret 0
  108. $LN2@recursion_:
  109. ; Line 18
  110. fld1
  111. pop esi
  112. ; Line 21
  113. ret 0
  114. _recursion_factorial ENDP
  115. _TEXT ENDS
  116. PUBLIC _sum
  117. ; Function compile flags: /Ogtpy
  118. _TEXT SEGMENT
  119. $T81329 = -8 ; size = 8
  120. tv133 = 8 ; size = 4
  121. _n$ = 8 ; size = 4
  122. _sum PROC
  123. ; Line 25
  124. mov edx, DWORD PTR _n$[esp-4]
  125. sub esp, 8
  126. cmp edx, 1
  127. je SHORT $LN1@sum
  128. test edx, edx
  129. je SHORT $LN1@sum ;; term cond
  130. ; Line 27
  131. lea ecx, DWORD PTR [edx-1]
  132. push ecx
  133. call _recursion_factorial
  134. mov DWORD PTR tv133[esp+8], edx
  135. fild DWORD PTR tv133[esp+8]
  136. test edx, edx
  137. jns SHORT $LN10@sum
  138. fadd QWORD PTR __real@41f0000000000000
  139. $LN10@sum:
  140. fmulp ST(1), ST(0)
  141. push ecx
  142. fstp QWORD PTR $T81329[esp+16]
  143. call _sum
  144. fadd QWORD PTR $T81329[esp+16]
  145. add esp, 8
  146. ; Line 28
  147. add esp, 8
  148. ret 0
  149. $LN1@sum:
  150. ; Line 26
  151. fld1
  152. ; Line 28
  153. add esp, 8
  154. ret 0
  155. _sum ENDP
  156. _TEXT ENDS
  157. PUBLIC _main
  158. EXTRN _printf:PROC
  159. EXTRN _scanf:PROC
  160. ; Function compile flags: /Ogtpy
  161. _TEXT SEGMENT
  162. _n$ = -28 ; size = 4
  163. tv164 = -24 ; size = 4
  164. $T81351 = -24 ; size = 8
  165. _linow$81335 = -16 ; size = 8
  166. _linow$81341 = -8 ; size = 8
  167. _main PROC
  168. ; Line 31
  169. push ebp
  170. mov ebp, esp
  171. and esp, -64 ; ffffffc0H
  172. sub esp, 48 ; 00000030H
  173. push ebx
  174. push ebp
  175. push esi
  176. push edi
  177. ; Line 35
  178. lea eax, DWORD PTR _n$[esp+64]
  179. push eax
  180. push OFFSET $SG81286
  181. call _scanf
  182. add esp, 8
  183. cmp eax, -1
  184. je $LN32@main
  185. xor ebx, ebx
  186. npad 6
  187. $LL8@main:
  188. cmp DWORD PTR _n$[esp+64], ebx
  189. jbe $LN32@main ;; scanf end
  190. ; Line 37
  191. xor esi, esi
  192. npad 4
  193. $LL6@main:
  194. ; Line 39
  195. mov edi, DWORD PTR __imp__QueryPerformanceFrequency@4
  196. push OFFSET ?li@?1??get_cpu_time@@9@9
  197. mov DWORD PTR _linow$81335[esp+68], ebx ;; 68 for push ^
  198. mov DWORD PTR _linow$81335[esp+72], ebx
  199. mov DWORD PTR ?li@?1??get_cpu_time@@9@9, ebx
  200. mov DWORD PTR ?li@?1??get_cpu_time@@9@9+4, ebx
  201. call edi ;; init li
  202. lea ecx, DWORD PTR _linow$81335[esp+64]
  203. push ecx
  204. call DWORD PTR __imp__QueryPerformanceCounter@4 ;; w linow
  205. mov edx, DWORD PTR _linow$81335[esp+68]
  206. mov eax, DWORD PTR _linow$81335[esp+64]
  207. push ebx
  208. push 1000000000 ; 3b9aca00H
  209. push edx
  210. push eax
  211. call __allmul ;; 64bit mul
  212. mov ecx, DWORD PTR ?li@?1??get_cpu_time@@9@9+4
  213. push ecx
  214. mov ecx, DWORD PTR ?li@?1??get_cpu_time@@9@9
  215. push ecx
  216. push edx
  217. push eax
  218. call __alldiv ;; resu in edx:eax
  219. ; Line 42
  220. push OFFSET ?li@?1??get_cpu_time@@9@9
  221. mov ebp, eax ;; start time, cropped
  222. mov DWORD PTR _linow$81341[esp+68], ebx
  223. mov DWORD PTR _linow$81341[esp+72], ebx
  224. mov DWORD PTR ?li@?1??get_cpu_time@@9@9, ebx
  225. mov DWORD PTR ?li@?1??get_cpu_time@@9@9+4, ebx
  226. call edi ;; init li again
  227. lea edx, DWORD PTR _linow$81341[esp+64]
  228. push edx
  229. call DWORD PTR __imp__QueryPerformanceCounter@4 ;; w linow
  230. mov eax, DWORD PTR _linow$81341[esp+68]
  231. mov ecx, DWORD PTR _linow$81341[esp+64]
  232. push ebx
  233. push 1000000000 ; 3b9aca00H
  234. push eax
  235. push ecx
  236. call __allmul
  237. mov ecx, DWORD PTR ?li@?1??get_cpu_time@@9@9+4
  238. push ecx
  239. mov ecx, DWORD PTR ?li@?1??get_cpu_time@@9@9
  240. push ecx
  241. push edx
  242. push eax
  243. call __alldiv ;; now computed
  244. mov edi, eax ;; cropped resu to edi
  245. ; Line 44
  246. cmp esi, 1
  247. je SHORT $LN17@main
  248. cmp esi, ebx
  249. je SHORT $LN17@main ;; factorial term cond check
  250. lea ecx, DWORD PTR [esi-1]
  251. push ecx
  252. call _recursion_factorial ;; sub factorial call
  253. mov edx, esi
  254. mov DWORD PTR tv164[esp+68], edx
  255. fild DWORD PTR tv164[esp+68] ;; type coercion on i?
  256. test edx, edx
  257. jns SHORT $LN34@main
  258. fadd QWORD PTR __real@41f0000000000000
  259. $LN34@main:
  260. fmulp ST(1), ST(0) ;; fact(i) in top
  261. push ecx
  262. fstp QWORD PTR $T81351[esp+72] ;; old son
  263. call _sum
  264. fadd QWORD PTR $T81351[esp+72] ;; son(i) in top
  265. add esp, 8
  266. jmp SHORT $LN19@main
  267. $LN17@main:
  268. fld1
  269. $LN19@main:
  270. sub edi, ebp ;; elapsed
  271. mov eax, 274877907 ; 10624dd3H
  272. imul edi
  273. sar edx, 6
  274. mov eax, edx
  275. shr eax, 31 ; 0000001fH
  276. add eax, edx
  277. push eax ;; elapsed
  278. sub esp, 8
  279. fstp QWORD PTR [esp] ;; sum(i)
  280. push esi ;; i
  281. push OFFSET $SG81293 ;; printf fmt string
  282. call _printf
  283. add esi, 10 ; 0000000aH
  284. add esp, 20 ; 00000014H
  285. cmp esi, DWORD PTR _n$[esp+64] ;; cmp i with n
  286. jbe $LL6@main ;; again
  287. ; Line 35
  288. lea ecx, DWORD PTR _n$[esp+64]
  289. push ecx
  290. push OFFSET $SG81286
  291. call _scanf ;; change n
  292. add esp, 8
  293. cmp eax, -1
  294. jne $LL8@main ;; n changed, back again
  295. $LN32@main:
  296. ; Line 48
  297. pop edi
  298. xor eax, eax
  299. pop esi
  300. pop ebp
  301. pop ebx
  302. mov esp, ebp
  303. pop ebp
  304. ret 0
  305. _main ENDP
  306. _TEXT ENDS
  307. END
Advertisement
Add Comment
Please, Sign In to add comment