	.386
	.model use32 small
	public _memchr
	.code
_memchr:
	push	ebp
	mov	ebp,esp
	push	edi
	mov	ecx,[16+ebp]
	mov	eax,[12+ebp]
	mov	edi,[8+ebp]
	cld
	repne	scasb
	jne	exit
	dec	edi
	mov	ecx,edi
exit:
	mov	eax,ecx
     	pop	edi
	pop	ebp
	ret
	end