C rewrite