#include <stdio.h>
const unsigned seed = 0x0C;
const unsigned mask = 0x11;
const unsigned bits = 5;
int main() {
unsigned reg = seed;
unsigned bp, t;
do {
printf("%d", reg & 1);
bp = reg & mask;
t = 0;
while (bp) {
t ^= bp & 1;
bp >>= 1;
}
reg >>= 1;
reg |= t << (bits-1);
} while (reg && reg != seed);
}