This `x ? "TRUE\n" : "FALSE\n"` is repeated quite a few times. It may be worthwhile to think of a way to make this a macro or function.