summaryrefslogtreecommitdiffhomepage
path: root/zlib/contrib/masmx86/match686.lst
blob: 315ad87dba2e3f0963fe7de12c3dc033551d7067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
Microsoft (R) Macro Assembler Version 14.16.27031.1	    09/14/19 11:35:23
match686.asm						     Page 1 - 1


				; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86
				; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
				; File written by Gilles Vollant, by converting match686.S from Brian Raiter
				; for MASM. This is as assembly version of longest_match
				;  from Jean-loup Gailly in deflate.c
				;
				;         http://www.zlib.net
				;         http://www.winimage.com/zLibDll
				;         http://www.muppetlabs.com/~breadbox/software/assembly.html
				;
				; For Visual C++ 4.x and higher and ML 6.x and higher
				;   ml.exe is distributed in
				;  http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
				;
				; this file contain two implementation of longest_match
				;
				;  this longest_match was written by Brian raiter (1998), optimized for Pentium Pro
				;   (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom)
				;
				;  for using an assembly version of longest_match, you need define ASMV in project
				;
				;    compile the asm file running
				;           ml /coff /Zi /c /Flmatch686.lst match686.asm
				;    and do not include match686.obj in your project
				;
				; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for
				;  Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor
				;  with autoselect (with cpu detection code)
				;  if you want support the old pentium optimization, you can still use these version
				;
				; this file is not optimized for old pentium, but it compatible with all x86 32 bits
				; processor (starting 80386)
				;
				;
				; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2

				;uInt longest_match(s, cur_match)
				;    deflate_state *s;
				;    IPos cur_match;                             /* current match */

 = 0000004C			    NbStack         equ     76
 = dword ptr[esp+NbStack-0]	    cur_match       equ     dword ptr[esp+NbStack-0]
 = dword ptr[esp+NbStack-4]	    str_s           equ     dword ptr[esp+NbStack-4]
				; 5 dword on top (ret,ebp,esi,edi,ebx)
 = dword ptr[esp+NbStack-8]	    adrret          equ     dword ptr[esp+NbStack-8]
 = dword ptr[esp+NbStack-12	    pushebp         equ     dword ptr[esp+NbStack-12]
   ]
 = dword ptr[esp+NbStack-16	    pushedi         equ     dword ptr[esp+NbStack-16]
   ]
 = dword ptr[esp+NbStack-20	    pushesi         equ     dword ptr[esp+NbStack-20]
   ]
 = dword ptr[esp+NbStack-24	    pushebx         equ     dword ptr[esp+NbStack-24]
   ]

 = dword ptr [esp+NbStack-2	    chain_length    equ     dword ptr [esp+NbStack-28]
   8]
 = dword ptr [esp+NbStack-3	    limit           equ     dword ptr [esp+NbStack-32]
   2]
 = dword ptr [esp+NbStack-3	    best_len        equ     dword ptr [esp+NbStack-36]
   6]
 = dword ptr [esp+NbStack-4	    window          equ     dword ptr [esp+NbStack-40]
   0]
 = dword ptr [esp+NbStack-4	    prev            equ     dword ptr [esp+NbStack-44]
   4]
 = word ptr [esp+NbStack-48	    scan_start      equ      word ptr [esp+NbStack-48]
   ]
 = dword ptr [esp+NbStack-5	    wmask           equ     dword ptr [esp+NbStack-52]
   2]
 = dword ptr [esp+NbStack-5	    match_start_ptr equ     dword ptr [esp+NbStack-56]
   6]
 = dword ptr [esp+NbStack-6	    nice_match      equ     dword ptr [esp+NbStack-60]
   0]
 = dword ptr [esp+NbStack-6	    scan            equ     dword ptr [esp+NbStack-64]
   4]

 = dword ptr [esp+NbStack-6	    windowlen       equ     dword ptr [esp+NbStack-68]
   8]
 = dword ptr [esp+NbStack-7	    match_start     equ     dword ptr [esp+NbStack-72]
   2]
 = dword ptr [esp+NbStack-7	    strend          equ     dword ptr [esp+NbStack-76]
   6]
 = 00000034			    NbStackAdd      equ     (NbStack-24)

				    .386p

				    name    gvmatch
				    .MODEL  FLAT



				;  all the +zlib1222add offsets are due to the addition of fields
				;  in zlib in the deflate_state structure since the asm code was first written
				;  (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
				;  (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
				;  if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").

 = 00000008			    zlib1222add         equ     8

				;  Note : these value are good with a 8 bytes boundary pack structure
 = 0000007C			    dep_chain_length    equ     74h+zlib1222add
 = 00000038			    dep_window          equ     30h+zlib1222add
 = 0000006C			    dep_strstart        equ     64h+zlib1222add
 = 00000078			    dep_prev_length     equ     70h+zlib1222add
 = 00000090			    dep_nice_match      equ     88h+zlib1222add
 = 0000002C			    dep_w_size          equ     24h+zlib1222add
 = 00000040			    dep_prev            equ     38h+zlib1222add
 = 00000034			    dep_w_mask          equ     2ch+zlib1222add
 = 0000008C			    dep_good_match      equ     84h+zlib1222add
 = 00000070			    dep_match_start     equ     68h+zlib1222add
 = 00000074			    dep_lookahead       equ     6ch+zlib1222add


 00000000			_TEXT                   segment

				IFDEF NOUNDERLINE
				ELSE
				            public  _longest_match
				            public  _match_init
				ENDIF

 = 00000102			    MAX_MATCH           equ     258
 = 00000003			    MIN_MATCH           equ     3
 = 00000106			    MIN_LOOKAHEAD       equ     (MAX_MATCH+MIN_MATCH+1)



 = 00000102			MAX_MATCH       equ     258
 = 00000003			MIN_MATCH       equ     3
 = 00000106			MIN_LOOKAHEAD   equ     (MAX_MATCH + MIN_MATCH + 1)
 = 00000100			MAX_MATCH_8_     equ     ((MAX_MATCH + 7) AND 0FFF0h)


				;;; stack frame offsets

 = esp + 0			chainlenwmask   equ  esp + 0    ; high word: current chain len
				                    ; low word: s->wmask
 = esp + 4			window      equ  esp + 4    ; local copy of s->window
 = esp + 8			windowbestlen   equ  esp + 8    ; s->window + bestlen
 = esp + 16			scanstart   equ  esp + 16   ; first two bytes of string
 = esp + 12			scanend     equ  esp + 12   ; last two bytes of string
 = esp + 20			scanalign   equ  esp + 20   ; dword-misalignment of string
 = esp + 24			nicematch   equ  esp + 24   ; a good enough match size
 = esp + 28			bestlen     equ  esp + 28   ; size of best match so far
 = esp + 32			scan        equ  esp + 32   ; ptr to string wanting match

 = 00000024			LocalVarsSize   equ 36
				;   saved ebx   byte esp + 36
				;   saved edi   byte esp + 40
				;   saved esi   byte esp + 44
				;   saved ebp   byte esp + 48
				;   return address  byte esp + 52
 = esp + 56			deflatestate    equ  esp + 56   ; the function arguments
 = esp + 60			curmatch    equ  esp + 60

				;;; Offsets for fields in the deflate_state structure. These numbers
				;;; are calculated from the definition of deflate_state, with the
				;;; assumption that the compiler will dword-align the fields. (Thus,
				;;; changing the definition of deflate_state could easily cause this
				;;; program to crash horribly, without so much as a warning at
				;;; compile time. Sigh.)

 = 0000002C			dsWSize     equ 36+zlib1222add
 = 00000034			dsWMask     equ 44+zlib1222add
 = 00000038			dsWindow    equ 48+zlib1222add
 = 00000040			dsPrev      equ 56+zlib1222add
 = 00000060			dsMatchLen  equ 88+zlib1222add
 = 00000064			dsPrevMatch equ 92+zlib1222add
 = 0000006C			dsStrStart  equ 100+zlib1222add
 = 00000070			dsMatchStart    equ 104+zlib1222add
 = 00000074			dsLookahead equ 108+zlib1222add
 = 00000078			dsPrevLen   equ 112+zlib1222add
 = 0000007C			dsMaxChainLen   equ 116+zlib1222add
 = 0000008C			dsGoodMatch equ 132+zlib1222add
 = 00000090			dsNiceMatch equ 136+zlib1222add


				;;; match686.asm -- Pentium-Pro-optimized version of longest_match()
				;;; Written for zlib 1.1.2
				;;; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
				;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html
				;;;
				;;
				;;  This software is provided 'as-is', without any express or implied
				;;  warranty.  In no event will the authors be held liable for any damages
				;;  arising from the use of this software.
				;;
				;;  Permission is granted to anyone to use this software for any purpose,
				;;  including commercial applications, and to alter it and redistribute it
				;;  freely, subject to the following restrictions:
				;;
				;;  1. The origin of this software must not be misrepresented; you must not
				;;     claim that you wrote the original software. If you use this software
				;;     in a product, an acknowledgment in the product documentation would be
				;;     appreciated but is not required.
				;;  2. Altered source versions must be plainly marked as such, and must not be
				;;     misrepresented as being the original software
				;;  3. This notice may not be removed or altered from any source distribution.
				;;

				;GLOBAL _longest_match, _match_init


				;SECTION    .text

				;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch)

				;_longest_match:
				    IFDEF NOUNDERLINE
				    ELSE
 00000000			    _longest_match      proc near
				    ENDIF
 00000000			.FPO (9, 4, 0, 0, 1, 0)

				;;; Save registers that the compiler may be using, and adjust esp to
				;;; make room for our stack frame.

 00000000  55			        push    ebp
 00000001  57			        push    edi
 00000002  56			        push    esi
 00000003  53			        push    ebx
 00000004  83 EC 24		        sub esp, LocalVarsSize

				;;; Retrieve the function arguments. ecx will hold cur_match
				;;; throughout the entire function. edx will hold the pointer to the
				;;; deflate_state structure during the function's setup (before
				;;; entering the main loop.

 00000007  8B 54 24 38		        mov edx, [deflatestate]
 0000000B  8B 4C 24 3C		        mov ecx, [curmatch]

				;;; uInt wmask = s->w_mask;
				;;; unsigned chain_length = s->max_chain_length;
				;;; if (s->prev_length >= s->good_match) {
				;;;     chain_length >>= 2;
				;;; }

 0000000F  8B 42 78		        mov eax, [edx + dsPrevLen]
 00000012  8B 9A 0000008C	        mov ebx, [edx + dsGoodMatch]
 00000018  3B C3		        cmp eax, ebx
 0000001A  8B 42 34		        mov eax, [edx + dsWMask]
 0000001D  8B 5A 7C		        mov ebx, [edx + dsMaxChainLen]
 00000020  7C 03		        jl  LastMatchGood
 00000022  C1 EB 02		        shr ebx, 2
 00000025			LastMatchGood:

				;;; chainlen is decremented once beforehand so that the function can
				;;; use the sign flag instead of the zero flag for the exit test.
				;;; It is then shifted into the high word, to make room for the wmask
				;;; value, which it will always accompany.

 00000025  4B			        dec ebx
 00000026  C1 E3 10		        shl ebx, 16
 00000029  0B D8		        or  ebx, eax
 0000002B  89 1C 24		        mov [chainlenwmask], ebx

				;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;

 0000002E  8B 82 00000090	        mov eax, [edx + dsNiceMatch]
 00000034  8B 5A 74		        mov ebx, [edx + dsLookahead]
 00000037  3B D8		        cmp ebx, eax
 00000039  7C 02		        jl  LookaheadLess
 0000003B  8B D8		        mov ebx, eax
 0000003D  89 5C 24 18		LookaheadLess:  mov [nicematch], ebx

				;;; register Bytef *scan = s->window + s->strstart;

 00000041  8B 72 38		        mov esi, [edx + dsWindow]
 00000044  89 74 24 04		        mov [window], esi
 00000048  8B 6A 6C		        mov ebp, [edx + dsStrStart]
 0000004B  8D 3C 2E		        lea edi, [esi + ebp]
 0000004E  89 7C 24 20		        mov [scan], edi

				;;; Determine how many bytes the scan ptr is off from being
				;;; dword-aligned.

 00000052  8B C7		        mov eax, edi
 00000054  F7 D8		        neg eax
 00000056  83 E0 03		        and eax, 3
 00000059  89 44 24 14		        mov [scanalign], eax

				;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
				;;;     s->strstart - (IPos)MAX_DIST(s) : NIL;

 0000005D  8B 42 2C		        mov eax, [edx + dsWSize]
 00000060  2D 00000106		        sub eax, MIN_LOOKAHEAD
 00000065  2B E8		        sub ebp, eax
 00000067  7F 02		        jg  LimitPositive
 00000069  33 ED		        xor ebp, ebp
 0000006B			LimitPositive:

				;;; int best_len = s->prev_length;

 0000006B  8B 42 78		        mov eax, [edx + dsPrevLen]
 0000006E  89 44 24 1C		        mov [bestlen], eax

				;;; Store the sum of s->window + best_len in esi locally, and in esi.

 00000072  03 F0		        add esi, eax
 00000074  89 74 24 08		        mov [windowbestlen], esi

				;;; register ush scan_start = *(ushf*)scan;
				;;; register ush scan_end   = *(ushf*)(scan+best_len-1);
				;;; Posf *prev = s->prev;

 00000078  0F B7 1F		        movzx   ebx, word ptr [edi]
 0000007B  89 5C 24 10		        mov [scanstart], ebx
 0000007F  0F B7 5C 07 FF	        movzx   ebx, word ptr [edi + eax - 1]
 00000084  89 5C 24 0C		        mov [scanend], ebx
 00000088  8B 7A 40		        mov edi, [edx + dsPrev]

				;;; Jump into the main loop.

 0000008B  8B 14 24		        mov edx, [chainlenwmask]
 0000008E  EB 1A		        jmp short LoopEntry

				align 4

				;;; do {
				;;;     match = s->window + cur_match;
				;;;     if (*(ushf*)(match+best_len-1) != scan_end ||
				;;;         *(ushf*)match != scan_start) continue;
				;;;     [...]
				;;; } while ((cur_match = prev[cur_match & wmask]) > limit
				;;;          && --chain_length != 0);
				;;;
				;;; Here is the inner loop of the function. The function will spend the
				;;; majority of its time in this loop, and majority of that time will
				;;; be spent in the first ten instructions.
				;;;
				;;; Within this loop:
				;;; ebx = scanend
				;;; ecx = curmatch
				;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
				;;; esi = windowbestlen - i.e., (window + bestlen)
				;;; edi = prev
				;;; ebp = limit

 00000090			LookupLoop:
 00000090  23 CA		        and ecx, edx
 00000092  0F B7 0C 4F		        movzx   ecx, word ptr [edi + ecx*2]
 00000096  3B CD		        cmp ecx, ebp
 00000098  0F 86 000000E0	        jbe LeaveNow
 0000009E  81 EA 00010000	        sub edx, 00010000h
 000000A4  0F 88 000000D4	        js  LeaveNow
 000000AA  0F B7 44 0E FF	LoopEntry:  movzx   eax, word ptr [esi + ecx - 1]
 000000AF  3B C3		        cmp eax, ebx
 000000B1  75 DD		        jnz LookupLoop
 000000B3  8B 44 24 04		        mov eax, [window]
 000000B7  0F B7 04 08		        movzx   eax, word ptr [eax + ecx]
 000000BB  3B 44 24 10		        cmp eax, [scanstart]
 000000BF  75 CF		        jnz LookupLoop

				;;; Store the current value of chainlen.

 000000C1  89 14 24		        mov [chainlenwmask], edx

				;;; Point edi to the string under scrutiny, and esi to the string we
				;;; are hoping to match it up with. In actuality, esi and edi are
				;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
				;;; initialized to -(MAX_MATCH_8 - scanalign).

 000000C4  8B 74 24 04		        mov esi, [window]
 000000C8  8B 7C 24 20		        mov edi, [scan]
 000000CC  03 F1		        add esi, ecx
 000000CE  8B 44 24 14		        mov eax, [scanalign]
 000000D2  BA FFFFFEF8		        mov edx, 0fffffef8h; -(MAX_MATCH_8)
 000000D7  8D BC 07		        lea edi, [edi + eax + 0108h] ;MAX_MATCH_8]
	   00000108
 000000DE  8D B4 06		        lea esi, [esi + eax + 0108h] ;MAX_MATCH_8]
	   00000108

				;;; Test the strings for equality, 8 bytes at a time. At the end,
				;;; adjust edx so that it is offset to the exact byte that mismatched.
				;;;
				;;; We already know at this point that the first three bytes of the
				;;; strings match each other, and they can be safely passed over before
				;;; starting the compare loop. So what this code does is skip over 0-3
				;;; bytes, as much as necessary in order to dword-align the edi
				;;; pointer. (esi will still be misaligned three times out of four.)
				;;;
				;;; It should be confessed that this loop usually does not represent
				;;; much of the total running time. Replacing it with a more
				;;; straightforward "rep cmpsb" would not drastically degrade
				;;; performance.

 000000E5			LoopCmps:
 000000E5  8B 04 16		        mov eax, [esi + edx]
 000000E8  33 04 17		        xor eax, [edi + edx]
 000000EB  75 14		        jnz LeaveLoopCmps
 000000ED  8B 44 16 04		        mov eax, [esi + edx + 4]
 000000F1  33 44 17 04		        xor eax, [edi + edx + 4]
 000000F5  75 07		        jnz LeaveLoopCmps4
 000000F7  83 C2 08		        add edx, 8
 000000FA  75 E9		        jnz LoopCmps
 000000FC  EB 71		        jmp short LenMaximum
 000000FE  83 C2 04		LeaveLoopCmps4: add edx, 4
 00000101  A9 0000FFFF		LeaveLoopCmps:  test    eax, 0000FFFFh
 00000106  75 06		        jnz LenLower
 00000108  83 C2 02		        add edx,  2
 0000010B  C1 E8 10		        shr eax, 16
 0000010E  2C 01		LenLower:   sub al, 1
 00000110  83 D2 00		        adc edx, 0

				;;; Calculate the length of the match. If it is longer than MAX_MATCH,
				;;; then automatically accept it as the best possible match and leave.

 00000113  8D 04 17		        lea eax, [edi + edx]
 00000116  8B 7C 24 20		        mov edi, [scan]
 0000011A  2B C7		        sub eax, edi
 0000011C  3D 00000102		        cmp eax, MAX_MATCH
 00000121  7D 4C		        jge LenMaximum

				;;; If the length of the match is not longer than the best match we
				;;; have so far, then forget it and return to the lookup loop.

 00000123  8B 54 24 38		        mov edx, [deflatestate]
 00000127  8B 5C 24 1C		        mov ebx, [bestlen]
 0000012B  3B C3		        cmp eax, ebx
 0000012D  7F 13		        jg  LongerMatch
 0000012F  8B 74 24 08		        mov esi, [windowbestlen]
 00000133  8B 7A 40		        mov edi, [edx + dsPrev]
 00000136  8B 5C 24 0C		        mov ebx, [scanend]
 0000013A  8B 14 24		        mov edx, [chainlenwmask]
 0000013D  E9 FFFFFF4E		        jmp LookupLoop

				;;;         s->match_start = cur_match;
				;;;         best_len = len;
				;;;         if (len >= nice_match) break;
				;;;         scan_end = *(ushf*)(scan+best_len-1);

 00000142  8B 5C 24 18		LongerMatch:    mov ebx, [nicematch]
 00000146  89 44 24 1C		        mov [bestlen], eax
 0000014A  89 4A 70		        mov [edx + dsMatchStart], ecx
 0000014D  3B C3		        cmp eax, ebx
 0000014F  7D 2D		        jge LeaveNow
 00000151  8B 74 24 04		        mov esi, [window]
 00000155  03 F0		        add esi, eax
 00000157  89 74 24 08		        mov [windowbestlen], esi
 0000015B  0F B7 5C 07 FF	        movzx   ebx, word ptr [edi + eax - 1]
 00000160  8B 7A 40		        mov edi, [edx + dsPrev]
 00000163  89 5C 24 0C		        mov [scanend], ebx
 00000167  8B 14 24		        mov edx, [chainlenwmask]
 0000016A  E9 FFFFFF21		        jmp LookupLoop

				;;; Accept the current string, with the maximum possible length.

 0000016F  8B 54 24 38		LenMaximum: mov edx, [deflatestate]
 00000173  C7 44 24 1C		        mov dword ptr [bestlen], MAX_MATCH
	   00000102
 0000017B  89 4A 70		        mov [edx + dsMatchStart], ecx

				;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
				;;; return s->lookahead;

 0000017E			LeaveNow:
 0000017E  8B 54 24 38		        mov edx, [deflatestate]
 00000182  8B 5C 24 1C		        mov ebx, [bestlen]
 00000186  8B 42 74		        mov eax, [edx + dsLookahead]
 00000189  3B D8		        cmp ebx, eax
 0000018B  7F 02		        jg  LookaheadRet
 0000018D  8B C3		        mov eax, ebx
 0000018F			LookaheadRet:

				;;; Restore the stack and return from whence we came.

 0000018F  83 C4 24		        add esp, LocalVarsSize
 00000192  5B			        pop ebx
 00000193  5E			        pop esi
 00000194  5F			        pop edi
 00000195  5D			        pop ebp

 00000196  C3			        ret
				; please don't remove this string !
				; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary!
 00000197  0D 0A 61 73 6D	    db     0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah
	   36 38 36 20 77
	   69 74 68 20 6D
	   61 73 6D 2C 20
	   6F 70 74 69 6D
	   69 73 65 64 20
	   61 73 73 65 6D
	   62 6C 79 20 63
	   6F 64 65 20 66
	   72 6F 6D 20 42
	   72 69 61 6E 20
	   52 61 69 74 65
	   72 2C 20 77 72
	   69 74 74 65 6E
	   20 31 39 39 38
	   0D 0A


				    IFDEF NOUNDERLINE
				    ELSE
 000001E4			    _longest_match      endp
				    ENDIF

				    IFDEF NOUNDERLINE
				    ELSE
 000001E4			    _match_init     proc near
 000001E4  C3			                    ret
 000001E5			    _match_init     endp
				    ENDIF


 000001E5			_TEXT   ends
				end
Microsoft (R) Macro Assembler Version 14.16.27031.1	    09/14/19 11:35:23
match686.asm						     Symbols 2 - 1




Segments and Groups:

                N a m e                 Size     Length   Align   Combine Class

FLAT . . . . . . . . . . . . . .	GROUP
_DATA  . . . . . . . . . . . . .	32 Bit	 00000000 Para	  Public  'DATA'	
_TEXT  . . . . . . . . . . . . .	32 Bit	 000001E5 Para	  Public  'CODE'	


Procedures, parameters, and locals:

                N a m e                 Type     Value    Attr

_longest_match . . . . . . . . .	P Near	 00000000 _TEXT	Length= 000001E4 Public
  LastMatchGood  . . . . . . . .	L Near	 00000025 _TEXT	
  LookaheadLess  . . . . . . . .	L Near	 0000003D _TEXT	
  LimitPositive  . . . . . . . .	L Near	 0000006B _TEXT	
  LookupLoop . . . . . . . . . .	L Near	 00000090 _TEXT	
  LoopEntry  . . . . . . . . . .	L Near	 000000AA _TEXT	
  LoopCmps . . . . . . . . . . .	L Near	 000000E5 _TEXT	
  LeaveLoopCmps4 . . . . . . . .	L Near	 000000FE _TEXT	
  LeaveLoopCmps  . . . . . . . .	L Near	 00000101 _TEXT	
  LenLower . . . . . . . . . . .	L Near	 0000010E _TEXT	
  LongerMatch  . . . . . . . . .	L Near	 00000142 _TEXT	
  LenMaximum . . . . . . . . . .	L Near	 0000016F _TEXT	
  LeaveNow . . . . . . . . . . .	L Near	 0000017E _TEXT	
  LookaheadRet . . . . . . . . .	L Near	 0000018F _TEXT	
_match_init  . . . . . . . . . .	P Near	 000001E4 _TEXT	Length= 00000001 Public


Symbols:

                N a m e                 Type     Value    Attr

@CodeSize  . . . . . . . . . . .	Number	 00000000h   
@DataSize  . . . . . . . . . . .	Number	 00000000h   
@Interface . . . . . . . . . . .	Number	 00000000h   
@Model . . . . . . . . . . . . .	Number	 00000007h   
@code  . . . . . . . . . . . . .	Text   	 _TEXT
@data  . . . . . . . . . . . . .	Text   	 FLAT
@fardata?  . . . . . . . . . . .	Text   	 FLAT
@fardata . . . . . . . . . . . .	Text   	 FLAT
@stack . . . . . . . . . . . . .	Text   	 FLAT
LocalVarsSize  . . . . . . . . .	Number	 00000024h   
MAX_MATCH_8_ . . . . . . . . . .	Number	 00000100h   
MAX_MATCH  . . . . . . . . . . .	Number	 00000102h   
MIN_LOOKAHEAD  . . . . . . . . .	Number	 00000106h   
MIN_MATCH  . . . . . . . . . . .	Number	 00000003h   
NbStackAdd . . . . . . . . . . .	Number	 00000034h   
NbStack  . . . . . . . . . . . .	Number	 0000004Ch   
adrret . . . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-8]
best_len . . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-36]
bestlen  . . . . . . . . . . . .	Text   	 esp + 28
chain_length . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-28]
chainlenwmask  . . . . . . . . .	Text   	 esp + 0
cur_match  . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-0]
curmatch . . . . . . . . . . . .	Text   	 esp + 60
deflatestate . . . . . . . . . .	Text   	 esp + 56
dep_chain_length . . . . . . . .	Number	 0000007Ch   
dep_good_match . . . . . . . . .	Number	 0000008Ch   
dep_lookahead  . . . . . . . . .	Number	 00000074h   
dep_match_start  . . . . . . . .	Number	 00000070h   
dep_nice_match . . . . . . . . .	Number	 00000090h   
dep_prev_length  . . . . . . . .	Number	 00000078h   
dep_prev . . . . . . . . . . . .	Number	 00000040h   
dep_strstart . . . . . . . . . .	Number	 0000006Ch   
dep_w_mask . . . . . . . . . . .	Number	 00000034h   
dep_w_size . . . . . . . . . . .	Number	 0000002Ch   
dep_window . . . . . . . . . . .	Number	 00000038h   
dsGoodMatch  . . . . . . . . . .	Number	 0000008Ch   
dsLookahead  . . . . . . . . . .	Number	 00000074h   
dsMatchLen . . . . . . . . . . .	Number	 00000060h   
dsMatchStart . . . . . . . . . .	Number	 00000070h   
dsMaxChainLen  . . . . . . . . .	Number	 0000007Ch   
dsNiceMatch  . . . . . . . . . .	Number	 00000090h   
dsPrevLen  . . . . . . . . . . .	Number	 00000078h   
dsPrevMatch  . . . . . . . . . .	Number	 00000064h   
dsPrev . . . . . . . . . . . . .	Number	 00000040h   
dsStrStart . . . . . . . . . . .	Number	 0000006Ch   
dsWMask  . . . . . . . . . . . .	Number	 00000034h   
dsWSize  . . . . . . . . . . . .	Number	 0000002Ch   
dsWindow . . . . . . . . . . . .	Number	 00000038h   
limit  . . . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-32]
match_start_ptr  . . . . . . . .	Text   	 dword ptr [esp+NbStack-56]
match_start  . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-72]
nice_match . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-60]
nicematch  . . . . . . . . . . .	Text   	 esp + 24
prev . . . . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-44]
pushebp  . . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-12]
pushebx  . . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-24]
pushedi  . . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-16]
pushesi  . . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-20]
scan_start . . . . . . . . . . .	Text   	 word ptr [esp+NbStack-48]
scanalign  . . . . . . . . . . .	Text   	 esp + 20
scanend  . . . . . . . . . . . .	Text   	 esp + 12
scanstart  . . . . . . . . . . .	Text   	 esp + 16
scan . . . . . . . . . . . . . .	Text   	 esp + 32
str_s  . . . . . . . . . . . . .	Text   	 dword ptr[esp+NbStack-4]
strend . . . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-76]
windowbestlen  . . . . . . . . .	Text   	 esp + 8
windowlen  . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-68]
window . . . . . . . . . . . . .	Text   	 esp + 4
wmask  . . . . . . . . . . . . .	Text   	 dword ptr [esp+NbStack-52]
zlib1222add  . . . . . . . . . .	Number	 00000008h   

	   0 Warnings
	   0 Errors