https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108757
--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> --- No? Take a=59 as counterexample: (a - (N*M)) / N + M = (59 - 2*30)/30 + 2 = ~0UL/30 + 2 but a / N = 59/30 = 1 Integer division in C is division towards zero, almost no normal algebraic simplifications apply there.