int gcd(int i, int j) { while (i != j) if (i > j) i -= j; else j -= i; return i; } Translates to: b test loop subgt Ri,Ri,Rj suble Rj,Rj,Ri test cmp Ri,Rj bne loop (Courtesy of the wikipedia)