#include <stdint.h>
#include <stddef.h>

struct runs { unsigned ones, zeros, alternating; };

static struct runs measure(const uint32_t *words, size_t count)
{
    struct runs best = {0, 0, 0};
    /* Scan 32 bits per word. Start a new run at each word boundary.
       Update all three maxima, including runs that end at bit 31. */
    (void)words;
    (void)count;
    return best;
}

static uint32_t digits(unsigned value)
{
    static const uint8_t glyph[] = {63, 6, 91, 79, 102, 109, 125, 7, 127, 111};
    return ((uint32_t)glyph[value / 10] << 8) | glyph[value % 10];
}

int main(void)
{
    static const uint32_t words[] = {0xfffffff0u, 0x80000001u, 0x33333333u};
    struct runs result = measure(words, sizeof words / sizeof words[0]);
    volatile uint32_t *const lower = (volatile uint32_t *)(uintptr_t)0xff200020u;
    volatile uint32_t *const upper = (volatile uint32_t *)(uintptr_t)0xff200030u;
    *lower = (digits(result.zeros) << 16) | digits(result.ones);
    *upper = digits(result.alternating);
    return 0;
}
