My thinking is as follows:
Since we start at the upper left corner, then any solution that has a number in any other corner that is less than the number in the upper left corner would be a rotation/reflection of a previous solution.
Additionally, since we work from top to bottom, any solution where the lower left corner is lower than the upper right corner would also be a rotation of a previous solution (rotated along a diagonal from upper left to lower right).
The commented out if statements in the switch/case appear to be an attempt at something like this.