memset32:
        stmfd sp!, {fp, lr}
        add   fp, sp, $4
        mov   r1, r10
        sub   r10, r3, $16
        add   r3, r10, $24
        add   r0, r10, $20
        str   r1, [r0]

@ mem_offset LOCAL_VAR 1
@ (stack-ref-n 1)
        ldr   r0, [r10, $4]
@ mem LOCAL_VAR_ASSIGNMENT 1
@ (stack-ref-n 0)
        ldr   r1, [r10]
@ (add)
        add   r0, r1, r0
        add   r0, r8, r0, lsl $2 @ r0 = &dest

@ n_words LOCAL_VAR 1
@ (stack-ref-n 3)
        ldr   r2, [r10, $12] @ r2 = n_words

@ val LOCAL_VAR 1
@ (stack-ref-n 2)
        ldr   r1, [r10, $8] @ r1 = val

        push  {r11}

        and   r11, r2, $7
        movs  r2, r2, lsr $3
        beq   memset32_residual

        push  {r3,r7-r10}
        mov   r3, r1
        mov   r4, r1
        mov   r5, r1
        mov   r6, r1
        mov   r7, r1
        mov   r8, r1
        mov   r9, r1
        mov   r10, r1
memset32_main_loop:
        stmia r0!, {r3-r10}
        subs  r2, $1
        bne   memset32_main_loop
        pop   {r3,r7-r10}

memset32_residual:
        subs  r11, $1
        strcs r1, [r0], $4
        bcs   memset32_residual

        pop   {r11}

@ (proc-end 5)
        mov   r3, r10
        add   r0, r10, $20
        ldr   r10, [r0]
@ (return)
        ldmfd sp!, {fp, pc}
.ltorg
