	.section	.text
	.global	strprefix
	.type	strprefix, %function
strprefix:
	sub	sp, sp, #12
	str	r0, [sp, #4]	@ Save string 1
	str	r1, [sp]	@ Save string 2
	ldrb	r1, [r1]	@ First byte of string 2 (length2)
	str	r1, [sp, #8]	@ length = byte
	ldrb	r0, [r0]	@ First byte of first string (length)
	cmp	r0, r1
	bhs	prepare_loop	@ Test if length is higher than or same as length2
	mov	r0, #0		@ Cannot be a prefix
	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 = string 2 + index, dereferenced
	ldr	r1, [sp, #4]
	add	r1, r0, r1
	ldrb	r1, [r1]	@ r1 = string 1 + 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
