c: main function