except CLion files

add .gitignore CLion’s .idea/ files.
add CMakeLists

add support for CMake
refactoring

split main.c into 3 files.
change tab size.
add more comments.
and some minor bug fixes.