The first thing you posted is an optimisation by someone who probably went overboard with const. accessing a->x through a pointer more than once may have generated worse code than accessing it through the pointer only once, and storing the result in a local variable.
The do .. while thing is to make this kind of code work:
if (expression) foo();else bar();
if foo did not use the while(0) trick, and instead had multiple statements within { and } in it, then the semicolon after what looks like just a function call, would cause the else not to match the if.
I would be very surtprised if do .. while(0) is ever responsible for even a single additional assembly instruction, probably even in debug builds, on just about any compiler. A do..while is as simple as a single test and branch, and when the test is always false, then it's effectively a branch-never instruction, of which there is no such thing.