	.section	.text
	.global	strsuffix
	.type	strsuffix, %function
strsuffix:
	sub	sp, sp, #8
	str	r0, [sp]	@ Save string
	str	r1, [sp, #4]	@ Save string2
	ldrb	r3, [r1]	@ First byte of string2 (length2)
	cmp	r3, #0
	beq	not_equal
	ldrb	r0, [r0]	@ First byte of first string (length)
	cmp	r0, r3
	bhs	prepare_loop	@ Test if length is higher than or same as length2
	b	not_equal
prepare_loop:
	add	r0, r0, #1	@ index = length + 1
	add	r3, r3, #1	@ index2 = length2 + 1
	b	loop
decrement_index:
	sub	r0, r0, #1	@ index = index - 1
	sub	r3, r3, #1	@ index2 = index2 - 1
loop:
	ldr	r2, [sp, #4]
	add	r1, r3, r2
	ldrb	r2, [r1]	@ r2 = string2 + index2, dereferenced
	ldr	r1, [sp]
	add	r1, r0, r1
	ldrb	r1, [r1]	@ r1 = string + index, dereferenced
	cmp	r2, r1
	bne	not_equal	@ r2 == r1
	cmp	r3, #2
	bne	decrement_index	@ index2 <> 2
	mov	r0, #1		@ Is a suffix
	b	end
not_equal:
	mov	r0, #0		@ Cannot be a suffix
end:
	add	sp, sp, #8
	mov	pc, lr		@ Return
