	.section	.text
	.global	memset
	.global	__aeabi_memset
	.type	memset, %function
memset:
__aeabi_memset:
	sub	sp, sp, #20
	str	r0, [sp, #12]	@ Save dst
	str	r1, [sp, #8]	@ Save char
	str	r2, [sp, #4]	@ Save length
	b	loop
copy_and_increment:
	ldr	r1, [sp, #8]	@ Load char
	ldr	r0, [sp, #12]	@ Load dst
	strb	r1, [r0]	@ *dst = char
	ldr	r0, [sp, #12]
	add	r0, r0, #1
	str	r0, [sp, #12]	@ dst++
	ldr	r0, [sp, #4]
	sub	r0, r0, #1
	str	r0, [sp, #4]	@ length--
loop:
	ldr	r0, [sp, #4]
	cmp	r0, #0
	bne	copy_and_increment
	add	sp, sp, #20
	mov	pc, lr		@ Return
