translation of javalin code into C