Fix bench.c bugs and Cleanup C codes