I am putting the input number n into the variable $M0 ...: $M0 =

...simulating the machine language program at the bottom of this page...

before: \$M2 = $M2 \$M0 = $M0

\n"; $M2 = $M2 + $M0; echo "

after: \$M2 = $M2 \$M0 = $M0

"; // computes r = n - 4*[n/4] and puts the result into $M0: echo "

0: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2

\n"; $M2 = (int)($M2/$M1); echo "

1: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2

\n"; $M2 = $M2 * $M1; echo "

2: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2

\n"; $M0 = $M0 - $M2; echo "

3: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2

\n"; // if $M0 != 0 (i. e., r != 0) jumps to 14 if ($M0 != 0) { echo "

flow 1: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2

\n"; $M1 = 0; // writes 0 in $M1 if r != 0 and stops } else { echo "

flow 2: \$M0 = $M0 \$M1 = $M1 \$M2 = $M2

\n"; $M1 = 0; // writes 1 in $M1 if r == 0 and stops $M1++; } echo "

the result: \$M1 = $M1

\n"; ?>