&gt;. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int gcd(int m, int n) {
	return n? gcd(n, m%n): m;
}

int gcd_stk(int m, int n) {
	int *stk;
	int sp;
	int ret;

	stk = malloc(1024);
	sp = 0;

	// push call frame
	stk[sp+0] = 0; // return value
	stk[sp+1] = 0; // return flag
	stk[sp+2] = m; // push m
	stk[sp+3] = n; // push n
	sp = sp + 4;

	while(s