[lib] gen.c cleanup