	.section	.text
	.global	streq
	.global	fpc_ansistr_compare_equal
	.type	streq, @function
streq:
fpc_ansistr_compare_equal:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%esi
	pushl	%edi
	movl	$0, %eax		# Default to false
	movl	12(%ebp), %edi		# Second string
	movzbl	(%edi), %ecx		# Save length of second string to %ecx
	movsbl	%cl, %ecx		# Get first byte of second string
	testl	%ecx, %ecx		# Test if the length of second string is zero
	jz	end
	movl	8(%ebp), %esi		# First string
	movzbl	(%esi), %edx
	movsbl	%dl, %edx		# Get first byte of first string
	cmpl	%ecx, %edx
	je	compare_block		# Test if the lengths are equal
	jmp	end			# Cannot be equal
compare_block:
	addl	$1, %esi		# Skip count byte of first string
	addl	$1, %edi		# Skip count byte of second string
	cld
	repe	cmpsb			# Repeat until %ecx is zero or bytes don't equal
	sete	%al			# Return 0 if Zero Flag is clear, else return 1
end:
	popl	%edi
	popl	%esi
	popl	%ebp
	ret
