!= 0)
The variables were meant to be (cast to) unsigned indeed.
Actually you get:
cmp a,#0 cmpne b,#0 beq else
Most ARM compilers can do basic stuff like this. The compilers I worked on can generate far more complex sequences of conditional execution.
The idea was to show that one can compile the && using a single branch even on ISAs that do not have conditional execution or a conditional move. If you don't have a min/clz instruction then using it as a primitive is not a good idea either.
The analysis of whether it is correct is trivial indeed, so compilers routinely optimize the &&, ||, and ?: operators. What is hard however is deciding whether it is beneficial without profile feedback.
Wilco