Original JavaScript
gcd (test (op =) (reg b) (const 0)) (branch (label gcd-done)) (assign t (op rem) (reg a) (reg b)) (assign a (reg b)) (assign b (reg t)) (goto (label gcd)) gcd-done (goto (reg continue)) $\vdots$ ;; Before calling gcd, we assign to continue ;; the label to which gcd should return. (assign continue (label after-gcd-1)) (goto (label gcd)) after-gcd-1 $\vdots$ ;; Here is the second call to gcd, with a different continuation. (assign continue (label after-gcd-2)) (goto (label gcd)) after-gcd-2 "gcd", test(list(op("="), reg("b"), constant(0))), branch(label("gcd_done")), assign("t", list(op("rem"), reg("a"), reg("b"))), assign("a", reg("b")), assign("b", reg("t")), go_to(label("gcd")), "gcd_done", go_to(reg("continue")), $\vdots$ // Before calling $\texttt{gcd}$, we assign to $\texttt{continue}$ // the label to which $\texttt{gcd}$ should return. assign("continue", label("after_gcd_1"))), go_to(label("gcd")), "after_gcd_1", $\vdots$ // Here is the second call to $\texttt{gcd}$, with a different continuation. assign("continue", label("after_gcd_2")), go_to(label("gcd")), "after_gcd_2"
Figure 5.10 Assigning labels to the continue register simplifies and generalizes the strategy shown in figure 5.9.
5.1.3   Subroutines