rewrite in C