define i32 @add(i32 %a, i32 %b) {
entry:
  br label %tailrecurse

tailrecurse:
  %a.tr = phi i32 [ %a, %entry ], [ %tmp2, %recurse ]
  %b.tr = phi i32 [ %b, %entry ], [ %tmp3, %recurse ]
  %tmp1 = icmp eq i32 %a.tr, 0
  br i1 %tmp1, label %done, label %recurse

recurse:
  %tmp2 = sub i32 %a.tr, 1
  %tmp3 = add i32 %b.tr, 1
  br label %tailrecurse

done:
  ret i32 %b.tr
}

----------------------------------------------------

[
	["keyword", "define"],
	["type", "i32"],
	["variable", "@add"],
	["punctuation", "("],
	["type", "i32"],
	["variable", "%a"],
	["punctuation", ","],
	["type", "i32"],
	["variable", "%b"],
	["punctuation", ")"],
	["punctuation", "{"],
	["label", "entry:"],
	["keyword", "br"],
	["type", "label"],
	["variable", "%tailrecurse"],
	["label", "tailrecurse:"],
	["variable", "%a.tr"],
	["punctuation", "="],
	["keyword", "phi"],
	["type", "i32"],
	["punctuation", "["],
	["variable", "%a"],
	["punctuation", ","],
	["variable", "%entry"],
	["punctuation", "]"],
	["punctuation", ","],
	["punctuation", "["],
	["variable", "%tmp2"],
	["punctuation", ","],
	["variable", "%recurse"],
	["punctuation", "]"],
	["variable", "%b.tr"],
	["punctuation", "="],
	["keyword", "phi"],
	["type", "i32"],
	["punctuation", "["],
	["variable", "%b"],
	["punctuation", ","],
	["variable", "%entry"],
	["punctuation", "]"],
	["punctuation", ","],
	["punctuation", "["],
	["variable", "%tmp3"],
	["punctuation", ","],
	["variable", "%recurse"],
	["punctuation", "]"],
	["variable", "%tmp1"],
	["punctuation", "="],
	["keyword", "icmp"],
	["keyword", "eq"],
	["type", "i32"],
	["variable", "%a.tr"],
	["punctuation", ","],
	["number", "0"],
	["keyword", "br"],
	["type", "i1"],
	["variable", "%tmp1"],
	["punctuation", ","],
	["type", "label"],
	["variable", "%done"],
	["punctuation", ","],
	["type", "label"],
	["variable", "%recurse"],
	["label", "recurse:"],
	["variable", "%tmp2"],
	["punctuation", "="],
	["keyword", "sub"],
	["type", "i32"],
	["variable", "%a.tr"],
	["punctuation", ","],
	["number", "1"],
	["variable", "%tmp3"],
	["punctuation", "="],
	["keyword", "add"],
	["type", "i32"],
	["variable", "%b.tr"],
	["punctuation", ","],
	["number", "1"],
	["keyword", "br"],
	["type", "label"],
	["variable", "%tailrecurse"],
	["label", "done:"],
	["keyword", "ret"],
	["type", "i32"],
	["variable", "%b.tr"],
	["punctuation", "}"]
]

----------------------------------------------------

An iterative example program.
