match686.lst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. Microsoft (R) Macro Assembler Version 8.00.50727.104 01/29/13 15:28:20
  2. match686.asm Page 1 - 1
  3. ; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86
  4. ; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
  5. ; File written by Gilles Vollant, by converting match686.S from Brian Raiter
  6. ; for MASM. This is as assembly version of longest_match
  7. ; from Jean-loup Gailly in deflate.c
  8. ;
  9. ; http://www.zlib.net
  10. ; http://www.winimage.com/zLibDll
  11. ; http://www.muppetlabs.com/~breadbox/software/assembly.html
  12. ;
  13. ; For Visual C++ 4.x and higher and ML 6.x and higher
  14. ; ml.exe is distributed in
  15. ; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
  16. ;
  17. ; this file contain two implementation of longest_match
  18. ;
  19. ; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro
  20. ; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom)
  21. ;
  22. ; for using an assembly version of longest_match, you need define ASMV in project
  23. ;
  24. ; compile the asm file running
  25. ; ml /coff /Zi /c /Flmatch686.lst match686.asm
  26. ; and do not include match686.obj in your project
  27. ;
  28. ; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for
  29. ; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor
  30. ; with autoselect (with cpu detection code)
  31. ; if you want support the old pentium optimization, you can still use these version
  32. ;
  33. ; this file is not optimized for old pentium, but it compatible with all x86 32 bits
  34. ; processor (starting 80386)
  35. ;
  36. ;
  37. ; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2
  38. ;uInt longest_match(s, cur_match)
  39. ; deflate_state *s;
  40. ; IPos cur_match; /* current match */
  41. = 0000004C NbStack equ 76
  42. = dword ptr[esp+NbStack-0] cur_match equ dword ptr[esp+NbStack-0]
  43. = dword ptr[esp+NbStack-4] str_s equ dword ptr[esp+NbStack-4]
  44. ; 5 dword on top (ret,ebp,esi,edi,ebx)
  45. = dword ptr[esp+NbStack-8] adrret equ dword ptr[esp+NbStack-8]
  46. = dword ptr[esp+NbStack-12 pushebp equ dword ptr[esp+NbStack-12]
  47. ]
  48. = dword ptr[esp+NbStack-16 pushedi equ dword ptr[esp+NbStack-16]
  49. ]
  50. = dword ptr[esp+NbStack-20 pushesi equ dword ptr[esp+NbStack-20]
  51. ]
  52. = dword ptr[esp+NbStack-24 pushebx equ dword ptr[esp+NbStack-24]
  53. ]
  54. = dword ptr [esp+NbStack-2 chain_length equ dword ptr [esp+NbStack-28]
  55. 8]
  56. = dword ptr [esp+NbStack-3 limit equ dword ptr [esp+NbStack-32]
  57. 2]
  58. = dword ptr [esp+NbStack-3 best_len equ dword ptr [esp+NbStack-36]
  59. 6]
  60. = dword ptr [esp+NbStack-4 window equ dword ptr [esp+NbStack-40]
  61. 0]
  62. = dword ptr [esp+NbStack-4 prev equ dword ptr [esp+NbStack-44]
  63. 4]
  64. = word ptr [esp+NbStack-48 scan_start equ word ptr [esp+NbStack-48]
  65. ]
  66. = dword ptr [esp+NbStack-5 wmask equ dword ptr [esp+NbStack-52]
  67. 2]
  68. = dword ptr [esp+NbStack-5 match_start_ptr equ dword ptr [esp+NbStack-56]
  69. 6]
  70. = dword ptr [esp+NbStack-6 nice_match equ dword ptr [esp+NbStack-60]
  71. 0]
  72. = dword ptr [esp+NbStack-6 scan equ dword ptr [esp+NbStack-64]
  73. 4]
  74. = dword ptr [esp+NbStack-6 windowlen equ dword ptr [esp+NbStack-68]
  75. 8]
  76. = dword ptr [esp+NbStack-7 match_start equ dword ptr [esp+NbStack-72]
  77. 2]
  78. = dword ptr [esp+NbStack-7 strend equ dword ptr [esp+NbStack-76]
  79. 6]
  80. = 00000034 NbStackAdd equ (NbStack-24)
  81. .386p
  82. name gvmatch
  83. .MODEL FLAT
  84. ; all the +zlib1222add offsets are due to the addition of fields
  85. ; in zlib in the deflate_state structure since the asm code was first written
  86. ; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
  87. ; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
  88. ; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
  89. = 00000008 zlib1222add equ 8
  90. ; Note : these value are good with a 8 bytes boundary pack structure
  91. = 0000007C dep_chain_length equ 74h+zlib1222add
  92. = 00000038 dep_window equ 30h+zlib1222add
  93. = 0000006C dep_strstart equ 64h+zlib1222add
  94. = 00000078 dep_prev_length equ 70h+zlib1222add
  95. = 00000090 dep_nice_match equ 88h+zlib1222add
  96. = 0000002C dep_w_size equ 24h+zlib1222add
  97. = 00000040 dep_prev equ 38h+zlib1222add
  98. = 00000034 dep_w_mask equ 2ch+zlib1222add
  99. = 0000008C dep_good_match equ 84h+zlib1222add
  100. = 00000070 dep_match_start equ 68h+zlib1222add
  101. = 00000074 dep_lookahead equ 6ch+zlib1222add
  102. 00000000 _TEXT segment
  103. IFDEF NOUNDERLINE
  104. ELSE
  105. public _longest_match
  106. public _match_init
  107. ENDIF
  108. = 00000102 MAX_MATCH equ 258
  109. = 00000003 MIN_MATCH equ 3
  110. = 00000106 MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
  111. = 00000102 MAX_MATCH equ 258
  112. = 00000003 MIN_MATCH equ 3
  113. = 00000106 MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1)
  114. = 00000100 MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h)
  115. ;;; stack frame offsets
  116. = esp + 0 chainlenwmask equ esp + 0 ; high word: current chain len
  117. ; low word: s->wmask
  118. = esp + 4 window equ esp + 4 ; local copy of s->window
  119. = esp + 8 windowbestlen equ esp + 8 ; s->window + bestlen
  120. = esp + 16 scanstart equ esp + 16 ; first two bytes of string
  121. = esp + 12 scanend equ esp + 12 ; last two bytes of string
  122. = esp + 20 scanalign equ esp + 20 ; dword-misalignment of string
  123. = esp + 24 nicematch equ esp + 24 ; a good enough match size
  124. = esp + 28 bestlen equ esp + 28 ; size of best match so far
  125. = esp + 32 scan equ esp + 32 ; ptr to string wanting match
  126. = 00000024 LocalVarsSize equ 36
  127. ; saved ebx byte esp + 36
  128. ; saved edi byte esp + 40
  129. ; saved esi byte esp + 44
  130. ; saved ebp byte esp + 48
  131. ; return address byte esp + 52
  132. = esp + 56 deflatestate equ esp + 56 ; the function arguments
  133. = esp + 60 curmatch equ esp + 60
  134. ;;; Offsets for fields in the deflate_state structure. These numbers
  135. ;;; are calculated from the definition of deflate_state, with the
  136. ;;; assumption that the compiler will dword-align the fields. (Thus,
  137. ;;; changing the definition of deflate_state could easily cause this
  138. ;;; program to crash horribly, without so much as a warning at
  139. ;;; compile time. Sigh.)
  140. = 0000002C dsWSize equ 36+zlib1222add
  141. = 00000034 dsWMask equ 44+zlib1222add
  142. = 00000038 dsWindow equ 48+zlib1222add
  143. = 00000040 dsPrev equ 56+zlib1222add
  144. = 00000060 dsMatchLen equ 88+zlib1222add
  145. = 00000064 dsPrevMatch equ 92+zlib1222add
  146. = 0000006C dsStrStart equ 100+zlib1222add
  147. = 00000070 dsMatchStart equ 104+zlib1222add
  148. = 00000074 dsLookahead equ 108+zlib1222add
  149. = 00000078 dsPrevLen equ 112+zlib1222add
  150. = 0000007C dsMaxChainLen equ 116+zlib1222add
  151. = 0000008C dsGoodMatch equ 132+zlib1222add
  152. = 00000090 dsNiceMatch equ 136+zlib1222add
  153. ;;; match686.asm -- Pentium-Pro-optimized version of longest_match()
  154. ;;; Written for zlib 1.1.2
  155. ;;; Copyright (C) 1998 Brian Raiter <[email protected]>
  156. ;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html
  157. ;;;
  158. ;;
  159. ;; This software is provided 'as-is', without any express or implied
  160. ;; warranty. In no event will the authors be held liable for any damages
  161. ;; arising from the use of this software.
  162. ;;
  163. ;; Permission is granted to anyone to use this software for any purpose,
  164. ;; including commercial applications, and to alter it and redistribute it
  165. ;; freely, subject to the following restrictions:
  166. ;;
  167. ;; 1. The origin of this software must not be misrepresented; you must not
  168. ;; claim that you wrote the original software. If you use this software
  169. ;; in a product, an acknowledgment in the product documentation would be
  170. ;; appreciated but is not required.
  171. ;; 2. Altered source versions must be plainly marked as such, and must not be
  172. ;; misrepresented as being the original software
  173. ;; 3. This notice may not be removed or altered from any source distribution.
  174. ;;
  175. ;GLOBAL _longest_match, _match_init
  176. ;SECTION .text
  177. ;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
  178. ;_longest_match:
  179. IFDEF NOUNDERLINE
  180. ELSE
  181. 00000000 _longest_match proc near
  182. ENDIF
  183. 00000000 .FPO (9, 4, 0, 0, 1, 0)
  184. ;;; Save registers that the compiler may be using, and adjust esp to
  185. ;;; make room for our stack frame.
  186. 00000000 55 push ebp
  187. 00000001 57 push edi
  188. 00000002 56 push esi
  189. 00000003 53 push ebx
  190. 00000004 83 EC 24 sub esp, LocalVarsSize
  191. ;;; Retrieve the function arguments. ecx will hold cur_match
  192. ;;; throughout the entire function. edx will hold the pointer to the
  193. ;;; deflate_state structure during the function's setup (before
  194. ;;; entering the main loop.
  195. 00000007 8B 54 24 38 mov edx, [deflatestate]
  196. 0000000B 8B 4C 24 3C mov ecx, [curmatch]
  197. ;;; uInt wmask = s->w_mask;
  198. ;;; unsigned chain_length = s->max_chain_length;
  199. ;;; if (s->prev_length >= s->good_match) {
  200. ;;; chain_length >>= 2;
  201. ;;; }
  202. 0000000F 8B 42 78 mov eax, [edx + dsPrevLen]
  203. 00000012 8B 9A 0000008C mov ebx, [edx + dsGoodMatch]
  204. 00000018 3B C3 cmp eax, ebx
  205. 0000001A 8B 42 34 mov eax, [edx + dsWMask]
  206. 0000001D 8B 5A 7C mov ebx, [edx + dsMaxChainLen]
  207. 00000020 7C 03 jl LastMatchGood
  208. 00000022 C1 EB 02 shr ebx, 2
  209. 00000025 LastMatchGood:
  210. ;;; chainlen is decremented once beforehand so that the function can
  211. ;;; use the sign flag instead of the zero flag for the exit test.
  212. ;;; It is then shifted into the high word, to make room for the wmask
  213. ;;; value, which it will always accompany.
  214. 00000025 4B dec ebx
  215. 00000026 C1 E3 10 shl ebx, 16
  216. 00000029 0B D8 or ebx, eax
  217. 0000002B 89 1C 24 mov [chainlenwmask], ebx
  218. ;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
  219. 0000002E 8B 82 00000090 mov eax, [edx + dsNiceMatch]
  220. 00000034 8B 5A 74 mov ebx, [edx + dsLookahead]
  221. 00000037 3B D8 cmp ebx, eax
  222. 00000039 7C 02 jl LookaheadLess
  223. 0000003B 8B D8 mov ebx, eax
  224. 0000003D 89 5C 24 18 LookaheadLess: mov [nicematch], ebx
  225. ;;; register Bytef *scan = s->window + s->strstart;
  226. 00000041 8B 72 38 mov esi, [edx + dsWindow]
  227. 00000044 89 74 24 04 mov [window], esi
  228. 00000048 8B 6A 6C mov ebp, [edx + dsStrStart]
  229. 0000004B 8D 7C 35 00 lea edi, [esi + ebp]
  230. 0000004F 89 7C 24 20 mov [scan], edi
  231. ;;; Determine how many bytes the scan ptr is off from being
  232. ;;; dword-aligned.
  233. 00000053 8B C7 mov eax, edi
  234. 00000055 F7 D8 neg eax
  235. 00000057 83 E0 03 and eax, 3
  236. 0000005A 89 44 24 14 mov [scanalign], eax
  237. ;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
  238. ;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
  239. 0000005E 8B 42 2C mov eax, [edx + dsWSize]
  240. 00000061 2D 00000106 sub eax, MIN_LOOKAHEAD
  241. 00000066 2B E8 sub ebp, eax
  242. 00000068 7F 02 jg LimitPositive
  243. 0000006A 33 ED xor ebp, ebp
  244. 0000006C LimitPositive:
  245. ;;; int best_len = s->prev_length;
  246. 0000006C 8B 42 78 mov eax, [edx + dsPrevLen]
  247. 0000006F 89 44 24 1C mov [bestlen], eax
  248. ;;; Store the sum of s->window + best_len in esi locally, and in esi.
  249. 00000073 03 F0 add esi, eax
  250. 00000075 89 74 24 08 mov [windowbestlen], esi
  251. ;;; register ush scan_start = *(ushf*)scan;
  252. ;;; register ush scan_end = *(ushf*)(scan+best_len-1);
  253. ;;; Posf *prev = s->prev;
  254. 00000079 0F B7 1F movzx ebx, word ptr [edi]
  255. 0000007C 89 5C 24 10 mov [scanstart], ebx
  256. 00000080 0F B7 5C 38 FF movzx ebx, word ptr [edi + eax - 1]
  257. 00000085 89 5C 24 0C mov [scanend], ebx
  258. 00000089 8B 7A 40 mov edi, [edx + dsPrev]
  259. ;;; Jump into the main loop.
  260. 0000008C 8B 14 24 mov edx, [chainlenwmask]
  261. 0000008F EB 1D jmp short LoopEntry
  262. align 4
  263. ;;; do {
  264. ;;; match = s->window + cur_match;
  265. ;;; if (*(ushf*)(match+best_len-1) != scan_end ||
  266. ;;; *(ushf*)match != scan_start) continue;
  267. ;;; [...]
  268. ;;; } while ((cur_match = prev[cur_match & wmask]) > limit
  269. ;;; && --chain_length != 0);
  270. ;;;
  271. ;;; Here is the inner loop of the function. The function will spend the
  272. ;;; majority of its time in this loop, and majority of that time will
  273. ;;; be spent in the first ten instructions.
  274. ;;;
  275. ;;; Within this loop:
  276. ;;; ebx = scanend
  277. ;;; ecx = curmatch
  278. ;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
  279. ;;; esi = windowbestlen - i.e., (window + bestlen)
  280. ;;; edi = prev
  281. ;;; ebp = limit
  282. 00000094 LookupLoop:
  283. 00000094 23 CA and ecx, edx
  284. 00000096 0F B7 0C 4F movzx ecx, word ptr [edi + ecx*2]
  285. 0000009A 3B CD cmp ecx, ebp
  286. 0000009C 0F 86 000000E0 jbe LeaveNow
  287. 000000A2 81 EA 00010000 sub edx, 00010000h
  288. 000000A8 0F 88 000000D4 js LeaveNow
  289. 000000AE 0F B7 44 31 FF LoopEntry: movzx eax, word ptr [esi + ecx - 1]
  290. 000000B3 3B C3 cmp eax, ebx
  291. 000000B5 75 DD jnz LookupLoop
  292. 000000B7 8B 44 24 04 mov eax, [window]
  293. 000000BB 0F B7 04 01 movzx eax, word ptr [eax + ecx]
  294. 000000BF 3B 44 24 10 cmp eax, [scanstart]
  295. 000000C3 75 CF jnz LookupLoop
  296. ;;; Store the current value of chainlen.
  297. 000000C5 89 14 24 mov [chainlenwmask], edx
  298. ;;; Point edi to the string under scrutiny, and esi to the string we
  299. ;;; are hoping to match it up with. In actuality, esi and edi are
  300. ;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
  301. ;;; initialized to -(MAX_MATCH_8 - scanalign).
  302. 000000C8 8B 74 24 04 mov esi, [window]
  303. 000000CC 8B 7C 24 20 mov edi, [scan]
  304. 000000D0 03 F1 add esi, ecx
  305. 000000D2 8B 44 24 14 mov eax, [scanalign]
  306. 000000D6 BA FFFFFEF8 mov edx, 0fffffef8h; -(MAX_MATCH_8)
  307. 000000DB 8D BC 38 lea edi, [edi + eax + 0108h] ;MAX_MATCH_8]
  308. 00000108
  309. 000000E2 8D B4 30 lea esi, [esi + eax + 0108h] ;MAX_MATCH_8]
  310. 00000108
  311. ;;; Test the strings for equality, 8 bytes at a time. At the end,
  312. ;;; adjust edx so that it is offset to the exact byte that mismatched.
  313. ;;;
  314. ;;; We already know at this point that the first three bytes of the
  315. ;;; strings match each other, and they can be safely passed over before
  316. ;;; starting the compare loop. So what this code does is skip over 0-3
  317. ;;; bytes, as much as necessary in order to dword-align the edi
  318. ;;; pointer. (esi will still be misaligned three times out of four.)
  319. ;;;
  320. ;;; It should be confessed that this loop usually does not represent
  321. ;;; much of the total running time. Replacing it with a more
  322. ;;; straightforward "rep cmpsb" would not drastically degrade
  323. ;;; performance.
  324. 000000E9 LoopCmps:
  325. 000000E9 8B 04 32 mov eax, [esi + edx]
  326. 000000EC 33 04 3A xor eax, [edi + edx]
  327. 000000EF 75 14 jnz LeaveLoopCmps
  328. 000000F1 8B 44 32 04 mov eax, [esi + edx + 4]
  329. 000000F5 33 44 3A 04 xor eax, [edi + edx + 4]
  330. 000000F9 75 07 jnz LeaveLoopCmps4
  331. 000000FB 83 C2 08 add edx, 8
  332. 000000FE 75 E9 jnz LoopCmps
  333. 00000100 EB 71 jmp short LenMaximum
  334. 00000102 83 C2 04 LeaveLoopCmps4: add edx, 4
  335. 00000105 A9 0000FFFF LeaveLoopCmps: test eax, 0000FFFFh
  336. 0000010A 75 06 jnz LenLower
  337. 0000010C 83 C2 02 add edx, 2
  338. 0000010F C1 E8 10 shr eax, 16
  339. 00000112 2C 01 LenLower: sub al, 1
  340. 00000114 83 D2 00 adc edx, 0
  341. ;;; Calculate the length of the match. If it is longer than MAX_MATCH,
  342. ;;; then automatically accept it as the best possible match and leave.
  343. 00000117 8D 04 3A lea eax, [edi + edx]
  344. 0000011A 8B 7C 24 20 mov edi, [scan]
  345. 0000011E 2B C7 sub eax, edi
  346. 00000120 3D 00000102 cmp eax, MAX_MATCH
  347. 00000125 7D 4C jge LenMaximum
  348. ;;; If the length of the match is not longer than the best match we
  349. ;;; have so far, then forget it and return to the lookup loop.
  350. 00000127 8B 54 24 38 mov edx, [deflatestate]
  351. 0000012B 8B 5C 24 1C mov ebx, [bestlen]
  352. 0000012F 3B C3 cmp eax, ebx
  353. 00000131 7F 13 jg LongerMatch
  354. 00000133 8B 74 24 08 mov esi, [windowbestlen]
  355. 00000137 8B 7A 40 mov edi, [edx + dsPrev]
  356. 0000013A 8B 5C 24 0C mov ebx, [scanend]
  357. 0000013E 8B 14 24 mov edx, [chainlenwmask]
  358. 00000141 E9 FFFFFF4E jmp LookupLoop
  359. ;;; s->match_start = cur_match;
  360. ;;; best_len = len;
  361. ;;; if (len >= nice_match) break;
  362. ;;; scan_end = *(ushf*)(scan+best_len-1);
  363. 00000146 8B 5C 24 18 LongerMatch: mov ebx, [nicematch]
  364. 0000014A 89 44 24 1C mov [bestlen], eax
  365. 0000014E 89 4A 70 mov [edx + dsMatchStart], ecx
  366. 00000151 3B C3 cmp eax, ebx
  367. 00000153 7D 2D jge LeaveNow
  368. 00000155 8B 74 24 04 mov esi, [window]
  369. 00000159 03 F0 add esi, eax
  370. 0000015B 89 74 24 08 mov [windowbestlen], esi
  371. 0000015F 0F B7 5C 38 FF movzx ebx, word ptr [edi + eax - 1]
  372. 00000164 8B 7A 40 mov edi, [edx + dsPrev]
  373. 00000167 89 5C 24 0C mov [scanend], ebx
  374. 0000016B 8B 14 24 mov edx, [chainlenwmask]
  375. 0000016E E9 FFFFFF21 jmp LookupLoop
  376. ;;; Accept the current string, with the maximum possible length.
  377. 00000173 8B 54 24 38 LenMaximum: mov edx, [deflatestate]
  378. 00000177 C7 44 24 1C mov dword ptr [bestlen], MAX_MATCH
  379. 00000102
  380. 0000017F 89 4A 70 mov [edx + dsMatchStart], ecx
  381. ;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
  382. ;;; return s->lookahead;
  383. 00000182 LeaveNow:
  384. 00000182 8B 54 24 38 mov edx, [deflatestate]
  385. 00000186 8B 5C 24 1C mov ebx, [bestlen]
  386. 0000018A 8B 42 74 mov eax, [edx + dsLookahead]
  387. 0000018D 3B D8 cmp ebx, eax
  388. 0000018F 7F 02 jg LookaheadRet
  389. 00000191 8B C3 mov eax, ebx
  390. 00000193 LookaheadRet:
  391. ;;; Restore the stack and return from whence we came.
  392. 00000193 83 C4 24 add esp, LocalVarsSize
  393. 00000196 5B pop ebx
  394. 00000197 5E pop esi
  395. 00000198 5F pop edi
  396. 00000199 5D pop ebp
  397. 0000019A C3 ret
  398. ; please don't remove this string !
  399. ; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary!
  400. 0000019B 0D 0A 61 73 6D db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah
  401. 36 38 36 20 77
  402. 69 74 68 20 6D
  403. 61 73 6D 2C 20
  404. 6F 70 74 69 6D
  405. 69 73 65 64 20
  406. 61 73 73 65 6D
  407. 62 6C 79 20 63
  408. 6F 64 65 20 66
  409. 72 6F 6D 20 42
  410. 72 69 61 6E 20
  411. 52 61 69 74 65
  412. 72 2C 20 77 72
  413. 69 74 74 65 6E
  414. 20 31 39 39 38
  415. 0D 0A
  416. IFDEF NOUNDERLINE
  417. ELSE
  418. 000001E8 _longest_match endp
  419. ENDIF
  420. IFDEF NOUNDERLINE
  421. ELSE
  422. 000001E8 _match_init proc near
  423. 000001E8 C3 ret
  424. 000001E9 _match_init endp
  425. ENDIF
  426. 000001E9 _TEXT ends
  427. end
  428. Microsoft (R) Macro Assembler Version 8.00.50727.104 01/29/13 15:28:20
  429. match686.asm Symbols 2 - 1
  430. Segments and Groups:
  431. N a m e Size Length Align Combine Class
  432. FLAT . . . . . . . . . . . . . . GROUP
  433. _DATA . . . . . . . . . . . . . 32 Bit 00000000 DWord Public 'DATA'
  434. _TEXT . . . . . . . . . . . . . 32 Bit 000001E9 DWord Public 'CODE'
  435. Procedures, parameters, and locals:
  436. N a m e Type Value Attr
  437. _longest_match . . . . . . . . . P Near 00000000 _TEXT Length= 000001E8 Public
  438. LastMatchGood . . . . . . . . L Near 00000025 _TEXT
  439. LookaheadLess . . . . . . . . L Near 0000003D _TEXT
  440. LimitPositive . . . . . . . . L Near 0000006C _TEXT
  441. LookupLoop . . . . . . . . . . L Near 00000094 _TEXT
  442. LoopEntry . . . . . . . . . . L Near 000000AE _TEXT
  443. LoopCmps . . . . . . . . . . . L Near 000000E9 _TEXT
  444. LeaveLoopCmps4 . . . . . . . . L Near 00000102 _TEXT
  445. LeaveLoopCmps . . . . . . . . L Near 00000105 _TEXT
  446. LenLower . . . . . . . . . . . L Near 00000112 _TEXT
  447. LongerMatch . . . . . . . . . L Near 00000146 _TEXT
  448. LenMaximum . . . . . . . . . . L Near 00000173 _TEXT
  449. LeaveNow . . . . . . . . . . . L Near 00000182 _TEXT
  450. LookaheadRet . . . . . . . . . L Near 00000193 _TEXT
  451. _match_init . . . . . . . . . . P Near 000001E8 _TEXT Length= 00000001 Public
  452. Symbols:
  453. N a m e Type Value Attr
  454. @CodeSize . . . . . . . . . . . Number 00000000h
  455. @DataSize . . . . . . . . . . . Number 00000000h
  456. @Interface . . . . . . . . . . . Number 00000000h
  457. @Model . . . . . . . . . . . . . Number 00000007h
  458. @code . . . . . . . . . . . . . Text _TEXT
  459. @data . . . . . . . . . . . . . Text FLAT
  460. @fardata? . . . . . . . . . . . Text FLAT
  461. @fardata . . . . . . . . . . . . Text FLAT
  462. @stack . . . . . . . . . . . . . Text FLAT
  463. LocalVarsSize . . . . . . . . . Number 00000024h
  464. MAX_MATCH_8_ . . . . . . . . . . Number 00000100h
  465. MAX_MATCH . . . . . . . . . . . Number 00000102h
  466. MIN_LOOKAHEAD . . . . . . . . . Number 00000106h
  467. MIN_MATCH . . . . . . . . . . . Number 00000003h
  468. NbStackAdd . . . . . . . . . . . Number 00000034h
  469. NbStack . . . . . . . . . . . . Number 0000004Ch
  470. adrret . . . . . . . . . . . . . Text dword ptr[esp+NbStack-8]
  471. best_len . . . . . . . . . . . . Text dword ptr [esp+NbStack-36]
  472. bestlen . . . . . . . . . . . . Text esp + 28
  473. chain_length . . . . . . . . . . Text dword ptr [esp+NbStack-28]
  474. chainlenwmask . . . . . . . . . Text esp + 0
  475. cur_match . . . . . . . . . . . Text dword ptr[esp+NbStack-0]
  476. curmatch . . . . . . . . . . . . Text esp + 60
  477. deflatestate . . . . . . . . . . Text esp + 56
  478. dep_chain_length . . . . . . . . Number 0000007Ch
  479. dep_good_match . . . . . . . . . Number 0000008Ch
  480. dep_lookahead . . . . . . . . . Number 00000074h
  481. dep_match_start . . . . . . . . Number 00000070h
  482. dep_nice_match . . . . . . . . . Number 00000090h
  483. dep_prev_length . . . . . . . . Number 00000078h
  484. dep_prev . . . . . . . . . . . . Number 00000040h
  485. dep_strstart . . . . . . . . . . Number 0000006Ch
  486. dep_w_mask . . . . . . . . . . . Number 00000034h
  487. dep_w_size . . . . . . . . . . . Number 0000002Ch
  488. dep_window . . . . . . . . . . . Number 00000038h
  489. dsGoodMatch . . . . . . . . . . Number 0000008Ch
  490. dsLookahead . . . . . . . . . . Number 00000074h
  491. dsMatchLen . . . . . . . . . . . Number 00000060h
  492. dsMatchStart . . . . . . . . . . Number 00000070h
  493. dsMaxChainLen . . . . . . . . . Number 0000007Ch
  494. dsNiceMatch . . . . . . . . . . Number 00000090h
  495. dsPrevLen . . . . . . . . . . . Number 00000078h
  496. dsPrevMatch . . . . . . . . . . Number 00000064h
  497. dsPrev . . . . . . . . . . . . . Number 00000040h
  498. dsStrStart . . . . . . . . . . . Number 0000006Ch
  499. dsWMask . . . . . . . . . . . . Number 00000034h
  500. dsWSize . . . . . . . . . . . . Number 0000002Ch
  501. dsWindow . . . . . . . . . . . . Number 00000038h
  502. limit . . . . . . . . . . . . . Text dword ptr [esp+NbStack-32]
  503. match_start_ptr . . . . . . . . Text dword ptr [esp+NbStack-56]
  504. match_start . . . . . . . . . . Text dword ptr [esp+NbStack-72]
  505. nice_match . . . . . . . . . . . Text dword ptr [esp+NbStack-60]
  506. nicematch . . . . . . . . . . . Text esp + 24
  507. prev . . . . . . . . . . . . . . Text dword ptr [esp+NbStack-44]
  508. pushebp . . . . . . . . . . . . Text dword ptr[esp+NbStack-12]
  509. pushebx . . . . . . . . . . . . Text dword ptr[esp+NbStack-24]
  510. pushedi . . . . . . . . . . . . Text dword ptr[esp+NbStack-16]
  511. pushesi . . . . . . . . . . . . Text dword ptr[esp+NbStack-20]
  512. scan_start . . . . . . . . . . . Text word ptr [esp+NbStack-48]
  513. scanalign . . . . . . . . . . . Text esp + 20
  514. scanend . . . . . . . . . . . . Text esp + 12
  515. scanstart . . . . . . . . . . . Text esp + 16
  516. scan . . . . . . . . . . . . . . Text esp + 32
  517. str_s . . . . . . . . . . . . . Text dword ptr[esp+NbStack-4]
  518. strend . . . . . . . . . . . . . Text dword ptr [esp+NbStack-76]
  519. windowbestlen . . . . . . . . . Text esp + 8
  520. windowlen . . . . . . . . . . . Text dword ptr [esp+NbStack-68]
  521. window . . . . . . . . . . . . . Text esp + 4
  522. wmask . . . . . . . . . . . . . Text dword ptr [esp+NbStack-52]
  523. zlib1222add . . . . . . . . . . Number 00000008h
  524. 0 Warnings
  525. 0 Errors