.section .text
.global _start
_start:
    la s1, samples
    li s0, 0                    # Largest result among completed words.
next_sample:
    lw a0, 0(s1)
    beqz a0, hold               # Zero marks the end of the list.
    addi s1, s1, 4
    call zeros
    bgeu s0, a0, next_sample
    mv s0, a0
    j next_sample
hold:
    j hold

zeros:
    # Return the longest run in a0. Preserve s0 and s1.
    li a0, 0
    ret

.section .data
.balign 4
samples:
    .word 0x30030003, 0x55500aaa, 0x7800001e, 0xe7fff000
    .word 0x00001000, 0xf0f0f0f0, 0x00c300c3, 0x33333333
    .word 0x80000007, 0x92345678, 0
