11.2.2.4 - 2


n dd (n - x )/4

y dd 2,4,6

m dd (m-y)/4

z dd (n-x)/4 dup (?)

k dd ?;

codeseg

begin:

push offset x [n] offset y [m] offset z

call vibor

mov [k], eax

call ExitProcess

proc vibor

push ebp;

mov ebp, esp;

Push ebx ecx edx esi edi

; for (i=j=0; i<n; i++){

mov ecx, [ebp+20]; ebp 0

mov ebx, [ebp+24]; &x eip 4

mov edx, [ebp+8] ; &z z 8

; for (k=0; k<m; k++); m 12

fori: ; y 16

push ecx ; n 20

mov ecx, [ebp+12] ; x 24

mov esi, [ebp+16]; &y

; if (x[i]==y[k]) break;

mov edi, [ebx]

fork:

cmp edi, [esi]

je short break

add esi, 4

loop fork

; if (k==m) z[j++] = x[i];

break:

test ecx, ecx

jne short next

mov [edx], edi

add edx, 4

next:

add ebx, 4

pop ecx

loop fori

; }

;

; z

mov eax, [ebp+8]

sub edx, eax

shr edx, 2

mov eax, edx

Pop edi esi edx ecx ebx

pop ebp

Ret 5*4

Endp

end begin

. . . . :