Emulate __sync atomic builtins with an ugly hack