/	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	"strcmp.s"

	.ident	"@(#)libc-i386:libc-i386/gen/strcmp.s	1.2.1.1"

	.globl	strcmp
	.align	4

strcmp:
	MCOUNT			/ subroutine entry counter if profiling
	pushl	%edi
	pushl	%esi
	movl	12(%esp),%esi	/ %edi = address of string 1
	movl	16(%esp),%edi	/ %esi = address of string 2
	cmpl	%esi,%edi	/ s1 == s2 ?
	je	.equal		/ yes
.loop:				/ Iterate for cache performance
	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	je	.equal

	slodb ; scab
	jne	.notequal
	testb	%al,%al
	jne	.loop

.equal:
	xorl	%eax,%eax
	popl	%esi
	popl	%edi		/ restore registers
	ret

.notequal:
	movzbl	%al,%eax
	movzbl	-1(%edi),%edx
	subl	%edx,%eax
	popl	%esi
	popl	%edi		/ restore registers
	ret
