	.section	.text
	.global	streq
	.global fpc_ansistr_compare_equal
streq:
fpc_ansistr_compare_equal:
	sub	sp, sp, #12
	str	r0, [sp, #4]	@ Save string1
	str	r1, [sp]	@ Save string2
	ldrb	r1, [r1]	@ First byte of string2 (length2)
	str	r1, [sp, #8]	@ Save it
	ldrb	r0, [r0]	@ First byte of first string (length)
	cmp	r1, r0
	beq	prepare_loop	@ length2 == length
	mov	r0, #0		@ Strings must not equal
	b	end
prepare_loop:
	mov	r0, #1		@ index = 1
	b	loop
increment_index:
	add	r0, r0, #1	@ index = index + 1
loop:
	ldr	r1, [sp, #8]
	cmp	r0, r1
	bhi	compare_length	@ index > length
	ldr	r2, [sp]
	add	r1, r0, r2
	ldrb	r2, [r1]	@ r2 = string2 + index, dereferenced
	ldr	r1, [sp, #4]
	add	r1, r0, r1
	ldrb	r1, [r1]	@ r1 = string1 + index, dereferenced
	cmp	r2, r1
	beq	increment_index	@ r2 == r1
compare_length:
	sub	r0, r0, #1	@ r0 = index - 1
	ldr	r1, [sp, #8]
	cmp	r1, r0
	ite	ne		@ r0 <> length
	movne	r0, #0		@ Return 0 if false
	moveq	r0, #1		@ Return 1 if true
end:
	add	sp, sp, #12
	mov	pc, lr		@ Return
