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

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

before: $M2 = 0 $M0 = 16

after: $M2 = 16 $M0 = 16

0: $M0 = 16 $M1 = 4 $M2 = 16

1: $M0 = 16 $M1 = 4 $M2 = 4

2: $M0 = 16 $M1 = 4 $M2 = 16

3: $M0 = 0 $M1 = 4 $M2 = 16

flow 2: $M0 = 0 $M1 = 4 $M2 = 16

the result: $M1 = 1