Each structured statement has a translation into assembly language's if-goto style.
Often the condition needs to be reversed, when the sense of the condition in high level language is the opposite of branching, i.e. it is continuation.
To see what I mean, let's look at the while loop first.
while ( condition )
body
The sense of the condition
is continuation with the body that comes up next.
In the if-goto style, the only thing we can do is branch to exit the loop, instead, so we must reverse the condition
, i.e. ! (condition)
.
if ( ! condition ) goto LoopExit;
body
LoopExit:
(The if-goto construct needs to choose between staying in the loop and exiting the loop — we cannot "branch" to stay in the loop, so the only option is to branch to exit and fall through to stay in the loop.)
Since the sense of the do while and sense of the if-goto are the same then the test condition is the same as in C. This is because both are changing flow of control back to the top of the loop.
For more on translating structured statements into assembly's if-goto style see this article.
https://erikeidt.github.io/Transforming%20Structured%20Statements%20into%20Assembly%20Language