Rewrite in C