Advertisement
Guest User

Untitled

a guest
Nov 30th, 2009
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ; int __thiscall CFG__CFG(CFG *this, area_t *a2)
  2.     CFG__CFG proc near                      ; CODE XREF: LOCAL__GenerateCFG+83p
  3.                                             ; CALLGRAPH__ConstructVertex+8Cp
  4.  
  5.     var_38__NumBlocks= dword ptr -38h
  6.     var_34__ea1= Edge ptr -34h
  7.     eavec= QVector ptr -2Ch
  8.     BasicBlock= BasicBlock ptr -20h
  9.     a2  = dword ptr  4
  10.  
  11. 000     sub esp, 38h
  12. 038     push ebx
  13. 03C     push ebp
  14. 040     push esi
  15. 044     xor ebx, ebx
  16. 044     push edi
  17. 048     mov edi, ecx
  18. 048     push 1                              ; arg_0
  19. 04C     lea ecx, [esp+4Ch+eavec]            ; this
  20. 04C     mov [edi+CFG.BasicBlockVector__Array], ebx
  21. 04C     mov [edi+CFG.BasicBlockVector__N], ebx
  22. 04C     mov [edi+CFG.BasicBlockVector__Alloc], ebx
  23. 04C     mov [esp+4Ch+eavec.array], ebx
  24. 04C     mov [esp+4Ch+eavec.n], ebx
  25. 04C     mov [esp+4Ch+eavec.alloc], ebx
  26. 04C     call QVECTOR__SIZE4__Reserve        ; no need to decompile.
  27. 048     mov ebp, [esp+48h+eavec.n]
  28. 048     mov ecx, [esp+48h+eavec.array]
  29. 048     lea eax, [ecx+ebp*4]
  30. 048     cmp eax, ebx
  31. 048     jz  short loc_10003071
  32. 048     mov edx, [esp+48h+a2]
  33. 048     mov edx, [edx+area_t.startEA]
  34. 048     mov [eax], edx
  35.  
  36.     loc_10003071:                           ; CODE XREF: CFG__CFG+37j
  37. 048     add ebp, 1
  38. 048     jz  loc_10003225
  39. 048     lea ebx, [ebx+0]
  40.  
  41.     loop_top:                               ; CODE XREF: CFG__CFG+1EFj
  42. 048     mov esi, [ecx]
  43. 048     lea eax, [ebp*4+0]
  44. 048     sar eax, 2
  45. 048     sub eax, 1
  46. 048     jz  short loc_100030A3
  47. 048     add eax, eax
  48. 048     add eax, eax
  49. 048     push eax
  50. 04C     lea edx, [ecx+4]
  51. 04C     push edx
  52. 050     push ecx
  53. 054     call memmove                        ; Microsoft VisualC 2-8/net runtime
  54. 054     add esp, 0Ch
  55.  
  56.     loc_100030A3:                           ; CODE XREF: CFG__CFG+5Fj
  57. 048     sub ebp, 1
  58. 048     push esi                            ; address
  59. 04C     mov ecx, edi                        ; this
  60. 04C     mov [esp+4Ch+eavec.n], ebp
  61. 04C     call CFG__Split                     ; decompiled.
  62. 048     test al, al
  63. 048     jnz loc_10003219
  64. 048     mov [esp+48h+BasicBlock.Edges.array], ebx
  65. 048     mov [esp+48h+BasicBlock.Edges.n], ebx
  66. 048     mov [esp+48h+BasicBlock.Edges.alloc], ebx
  67. 048     mov [esp+48h+BasicBlock.Eapairs.array], ebx
  68. 048     mov [esp+48h+BasicBlock.Eapairs.n], ebx
  69. 048     mov [esp+48h+BasicBlock.Eapairs.alloc], ebx
  70. 048     mov [esp+48h+BasicBlock.Boundaries.ea1], esi
  71. 048     mov [esp+48h+BasicBlock.Boundaries.ea2], esi
  72. 048     mov bl, 1
  73. 048     lea esp, [esp+0]
  74.  
  75.     inner_loop_top:                         ; CODE XREF: CFG__CFG+10Aj
  76. 048     push 0
  77. 04C     push esi
  78. 050     call get_flags_ex
  79. 048     mov ecx, eax
  80. 048     shr ecx, 10h
  81. 048     test cl, 1
  82. 048     jnz short loc_100030F8
  83. 048     cmp esi, [esp+48h+BasicBlock.Boundaries.ea1]
  84. 048     jnz short loc_10003171
  85.  
  86.     loc_100030F8:                           ; CODE XREF: CFG__CFG+C0j
  87. 048     and eax, 600h
  88. 048     cmp eax, 600h
  89. 048     jnz short loc_10003171
  90. 048     push esi                            ; address
  91. 04C     mov ecx, edi                        ; this
  92. 04C     call CFG__Split                     ; decompiled.
  93. 048     test al, al
  94. 048     jnz short another_break
  95. 048     mov ecx, [esp+48h+a2]
  96. 048     lea edx, [esp+48h+BasicBlock]
  97. 048     push edx                            ; block
  98. 04C     lea eax, [esp+4Ch+eavec]
  99. 04C     push eax                            ; eavec
  100. 050     push ecx                            ; address
  101. 054     mov ecx, edi
  102. 054     call CFG__Member3                   ; this is in fact a member function of the class,
  103.                                             ; HOWEVER it does not use its this pointer at all.
  104.                                             ; decompiled.
  105. 048     test al, al
  106. 048     jz  short loc_1000312C
  107. 048     xor bl, bl
  108.  
  109.     loc_1000312C:                           ; CODE XREF: CFG__CFG+F8j
  110. 048     push esi
  111. 04C     call get_item_end
  112. 048     test bl, bl
  113. 048     mov esi, eax
  114. 048     mov [esp+48h+BasicBlock.Boundaries.ea2], esi
  115. 048     jnz short inner_loop_top
  116. 048     jmp short loc_10003171
  117.     ; ---------------------------------------------------------------------------
  118.  
  119.     another_break:                          ; CODE XREF: CFG__CFG+DEj
  120. 048     mov edx, [esp+48h+BasicBlock.Edges.n]
  121. 048     add edx, 1
  122. 048     push edx
  123. 04C     lea ecx, [esp+4Ch+BasicBlock.Edges]
  124. 04C     mov ebp, 3
  125. 04C     call QVECTOR__SIZE8__Reserve        ; no need to decompile.
  126. 048     mov eax, [esp+48h+BasicBlock.Edges.n]
  127. 048     mov ecx, [esp+48h+BasicBlock.Edges.array]
  128. 048     lea eax, [ecx+eax*8]
  129. 048     test eax, eax
  130. 048     jz  short loc_10003168
  131. 048     mov [eax+Edge.ea], esi
  132. 048     mov [eax+Edge.type], ebp
  133.  
  134.     loc_10003168:                           ; CODE XREF: CFG__CFG+131j
  135. 048     add [esp+48h+BasicBlock.Edges.n], 1
  136. 048     mov esi, [esp+48h+BasicBlock.Boundaries.ea2]
  137.  
  138.     loc_10003171:                           ; CODE XREF: CFG__CFG+C6j
  139.                                             ; CFG__CFG+D2j ...
  140. 048     mov eax, [edi+CFG.BasicBlockVector__N]
  141. 048     mov ecx, [edi+CFG.BasicBlockVector__Alloc]
  142. 048     add eax, 1
  143.     ; reserve()
  144.  
  145.     loc_100031AF:                           ; CODE XREF: CFG__CFG+14Cj
  146. 048     mov ebp, [edi+CFG.BasicBlockVector__N]
  147. 048     shl ebp, 5
  148. 048     add ebp, [edi+CFG.BasicBlockVector__Array]
  149. 048     jz  short loc_100031F1
  150. 048     mov eax, [esp+48h+BasicBlock.Boundaries.ea1]
  151. 048     mov [ebp+BasicBlock.Boundaries.ea2], esi
  152. 048     lea ecx, [ebp+BasicBlock.Edges.array]
  153. 048     mov [ebp+BasicBlock.Boundaries.ea1], eax
  154. 048     xor esi, esi
  155. 048     lea edx, [esp+48h+BasicBlock.Edges]
  156. 048     push edx
  157. 04C     mov [ecx+QVector.array], esi
  158. 04C     mov [ecx+QVector.n], esi
  159. 04C     mov [ecx+QVector.alloc], esi
  160. 04C     call QVECTOR__SIZE8__Assign         ; no need to decompile.
  161. 048     lea ecx, [ebp+BasicBlock.Eapairs.array]
  162. 048     lea eax, [esp+48h+BasicBlock.Eapairs]
  163. 048     push eax
  164. 04C     mov [ecx+QVector.array], esi
  165. 04C     mov [ecx+QVector.n], esi
  166. 04C     mov [ecx+QVector.alloc], esi
  167. 04C     call QVECTOR__SIZE8__Assign         ; no need to decompile.
  168. 048     jmp short loc_100031F3
  169.     ; ---------------------------------------------------------------------------
  170.  
  171.     loc_100031F1:                           ; CODE XREF: CFG__CFG+187j
  172. 048     xor esi, esi
  173.  
  174.     loc_100031F3:                           ; CODE XREF: CFG__CFG+1BFj
  175. 048     mov eax, [esp+48h+BasicBlock.Eapairs.array]
  176. 048     add [edi+CFG.BasicBlockVector__N], 1
  177. 048     cmp eax, esi
  178. 048     jz  short loc_10003205
  179. 048     push eax
  180. 04C     call qfree
  181.  
  182.     loc_10003205:                           ; CODE XREF: CFG__CFG+1CDj
  183. 048     mov eax, [esp+48h+BasicBlock.Edges.array]
  184. 048     cmp eax, esi
  185. 048     jz  short loc_10003213
  186. 048     push eax
  187. 04C     call qfree
  188.  
  189.     loc_10003213:                           ; CODE XREF: CFG__CFG+1DBj
  190. 048     mov ebp, [esp+48h+eavec.n]
  191. 048     xor ebx, ebx
  192.  
  193.     loc_10003219:                           ; CODE XREF: CFG__CFG+84j
  194. 048     cmp ebp, ebx
  195. 048     mov ecx, [esp+48h+eavec.array]
  196. 048     jnz loop_top
  197.  
  198.     loc_10003225:                           ; CODE XREF: CFG__CFG+44j
  199. 048     mov eax, [edi+CFG.BasicBlockVector__N]
  200. 048     cmp eax, ebx
  201. 048     mov [edi+CFG.NumBlocks], eax
  202. 048     mov [esp+48h+var_38__NumBlocks], ebx
  203. 048     jle loc_1000331D
  204.  
  205.     second_loop_top:                        ; CODE XREF: CFG__CFG+2E5j
  206. 048     mov edx, [edi+CFG.BasicBlockVector__Array]
  207. 048     xor ebp, ebp
  208. 048     cmp [ebx+edx+BasicBlock.Edges.n], ebp
  209. 048     mov [esp+48h+a2], ebp
  210. 048     jle loc_10003304
  211. 048     lea esp, [esp+0]
  212.  
  213.     second_inner_loop_top:                  ; CODE XREF: CFG__CFG+2CAj
  214. 048     mov eax, [edi+CFG.BasicBlockVector__Array]
  215. 048     mov ecx, [ebx+eax+BasicBlock.Boundaries.ea1]
  216. 048     mov edx, [ebx+eax+BasicBlock.Edges.array]
  217. 048     mov [esp+48h+var_34__ea1.ea], ecx
  218. 048     mov ecx, [edx+ebp*8+Edge.type]
  219. 048     lea edx, [edx+ebp*8]
  220. 048     mov [esp+48h+var_34__ea1.type], ecx
  221. 048     xor ecx, ecx
  222. 048     cmp [edi+CFG.NumBlocks], ecx
  223. 048     jle short third_inner_loop_follow
  224. 048     mov edx, [edx+Edge.ea]
  225. 048     mov esi, eax
  226.  
  227.     second_inner_inner_loop_top:            ; CODE XREF: CFG__CFG+250j
  228. 048     cmp [esi+BasicBlock.Boundaries.ea1], edx
  229. 048     jz  short loc_10003285
  230. 048     add ecx, 1
  231. 048     add esi, size BasicBlock
  232. 048     cmp ecx, [edi+CFG.NumBlocks]
  233. 048     jl  short second_inner_inner_loop_top
  234.  
  235.     third_inner_loop_follow:                ; CODE XREF: CFG__CFG+23Dj
  236. 048     or  ecx, 0FFFFFFFFh
  237.  
  238.     loc_10003285:                           ; CODE XREF: CFG__CFG+245j
  239. 048     shl ecx, 5
  240. 048     lea esi, [ecx+eax+BasicBlock.Eapairs]
  241. 048     mov eax, [esi+QVector.n]
  242. 048     mov ecx, [esi+QVector.alloc]
  243. 048     add eax, 1
  244.     ; reserve()
  245.  
  246.     loc_100032D0:                           ; CODE XREF: CFG__CFG+267j
  247. 048     mov eax, [esi+QVector.n]
  248. 048     mov ecx, [esi+QVector.array]
  249. 048     lea eax, [ecx+eax*8]
  250. 048     test eax, eax
  251. 048     jz  short loc_100032E9
  252. 048     mov edx, [esp+48h+var_34__ea1.ea]
  253. 048     mov ecx, [esp+48h+var_34__ea1.type]
  254. 048     mov [eax], edx
  255. 048     mov [eax+4], ecx
  256.  
  257.     loc_100032E9:                           ; CODE XREF: CFG__CFG+2AAj
  258. 048     add [esi+QVector.n], 1
  259. 048     mov edx, [edi+CFG.BasicBlockVector__Array]
  260. 048     add ebp, 1
  261. 048     cmp ebp, [ebx+edx+BasicBlock.Edges.n]
  262. 048     mov [esp+48h+a2], ebp
  263. 048     jl  second_inner_loop_top
  264. 048     mov ecx, [esp+48h+eavec.array]
  265.  
  266.     loc_10003304:                           ; CODE XREF: CFG__CFG+213j
  267. 048     mov eax, [esp+48h+var_38__NumBlocks]
  268. 048     add eax, 1
  269. 048     add ebx, 20h
  270. 048     cmp eax, [edi+CFG.NumBlocks]
  271. 048     mov [esp+48h+var_38__NumBlocks], eax
  272. 048     jl  second_loop_top
  273. 048     xor ebx, ebx
  274.  
  275.     loc_1000331D:                           ; CODE XREF: CFG__CFG+201j
  276. 048     cmp ecx, ebx
  277. 048     jz  short loc_10003327
  278. 048     push ecx
  279. 04C     call qfree
  280.  
  281.     loc_10003327:                           ; CODE XREF: CFG__CFG+2EFj
  282. 048     mov eax, edi
  283. 048     pop edi
  284. 044     pop esi
  285. 040     pop ebp
  286. 03C     pop ebx
  287. 038     add esp, 38h
  288. 000     retn 4
  289.     CFG__CFG endp
  290.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement