Update gen_brackets.c

Cleaner implementation