if ( A or theRest ) ----> |
statement1; V
else +--------------+ TRUE
statement2; | eval A |--------+
+--------------+ |
| |
| FALSE |
V |
+--------------+ FALSE |
| eval theRest |--------|---+
+--------------+ | |
| TRUE | |
| | |
V | |
statement1 <---------+ |
| |
+---------+ |
| |
| +--------------------+
| |
| V
| statement2
| |
| |
+-------->+
|
|
V
|
Evaluate "A" (CMP)
TRUE
Branch on TRUE (!!!) outcome of "condition" to here (A:) ---+
| |
| FALSE |
V |
Evaluate "theRest" (another CMP) |
| FALSE
Branch on FALSE (!!!) outcome of "theRest" to here (B:) ----|-----+
| | |
| TRUE | |
V | |
A: "statement1" assembler code <--------------------------+ |
| |
Branch always to there (C:) -------------+ |
| |
| |
B: "statement2" assembler code <---------|----------------------+
| |
V |
C: +<-------------------------------+
|
V
|
int x, y, a;
if (x <= a || x >= b)
x = x + 1;
else
x = x - 1;
The flow chart of the above program is:
|
Assembler program for this compound if-statement: click here