System F style static typechecker for C