```
(bind-func Rational_greatest_common_divisor
(lambda (m:i64 n:i64)
(if (and (= m 0) (= n 0))
-1
(let ((r 0))
(if (< m 0) (set! m (* m -1)))
(if (< n 0) (set! n (* n -1)))
(while (not (= n 0))
(set! r (% m n))
(set! m n)
(set! n r))
m))))
```

Back to Index