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

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

	.globl	strcpy
	.align	4

strcpy:
	MCOUNT			/ profiling
	pushl	%edi		/ save register variables
	movl	%esi,%edx

	movl	12(%esp),%edi	/ %edi = source string address
	xorl	%eax,%eax	/ %al = 0 (search for 0)
	movl	$-1,%ecx	/ length to look: lots
	repnz ; scab

	notl	%ecx		/ %ecx = length to move
	movl	12(%esp),%esi	/ %esi = source string address
	movl	8(%esp),%edi	/ %edi = destination string address
	movl	%ecx,%eax	/ %eax = length to move
	shrl	$2,%ecx		/ %ecx = words to move
	rep ; smovl

	movl	%eax,%ecx	/ %ecx = length to move
	andl	$3,%ecx		/ %ecx = leftover bytes to move
	rep ; smovb

	movl	8(%esp),%eax	/ %eax = returned dest string addr
	movl	%edx,%esi	/ restore register variables
	popl	%edi
	ret
