/	Copyright (c) 1984, 1986, 1987, 1988 AT&T
/	  All Rights Reserved

/	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
/	The copyright notice above does not evidence any
/	actual or intended publication of such source code.
	.file	"memchr.s"

	.ident	"@(#)libc-i386:libc-i386/gen/memchr.s	1.2"

	.globl	memchr
	.align	4

memchr:
	MCOUNT			/ profiling
	pushl	%edi
	movl	8(%esp),%edi	/ %edi = string address
	movb	12(%esp),%al	/ %al = byte that is sought
	movl	16(%esp),%ecx	/ %ecx = number of bytes
	repnz ; scab		/ look for %al
	jne	.notfound	/ search failed

	movl	%edi,%eax	/ found it.
	decl	%eax		/ search increments after finding
	popl	%edi		/ restore register variable
	ret	
.notfound:
	xorl	%eax,%eax
	popl	%edi		/ restore register variable
	ret	
