Rewrite gic in C