RED
Foolishly set yes to 0, again!
It's not entirely foolish, for the case of non-overflow (no=1) this tests whether the 4th leg (assume we count from 0 so that d[0] is the 0th leg) is bigger than it's limit.
Inside the processor, there is a pipeline that executes each stage of an instruction, say CMP, logical AND, or logical OR. The pipeline is broken down to a certain number of stages so this gets parallelized to some extent by each of these instructions in the function preoccupying one of the stages. It's sort of like this:
AND
---------> Step 1 -------> ---------> Step 3 ------->
OR
---------> Step 1 -------> ---------> Step 3 ------->
CMP
---------> Step 1 -------> Step 2 ---------> Step 3 -------> Step 4
Assignment (=)
/* Big latency if variable is in a memory location, could be 1 step if it's on a register and a couple more if it's in the cache */
* These are just approximations, the actual number of stages could be completely different.
The same circuitry is used for each step number, that means in the whole processor thread, you can only have one instruction occupying step 1 circuits at a time, same for steps 2 3 and 4, and some of these instructions are so fast they skip some of the pipeline steps and its circuits, which means that if you arrange the instructions in such a way that you put the faster ones before the slower ones, they don't have to wait for the slow instruction to finish going through the pipeline and that makes the whole function faster.
E.g.
int f(int a, int b) {
// some fast instruction using a and b
// some more fast instructions using a and b
// some assignment to memory, cache or a function call
}
Arranging the functions in this way prevents it from stalling on assignments and calls. Inserting lines full of logical ops and an assignment makes the logical statements run
faster.