It is in rr/lib/rr#thvry.tph. It's interspersed with other things, but there are comments that may be helpful in identifying which parts you want.
Okay, sorry for my egoistic nitpicking again. Checking it out.
...
Just the pointer I needed, thanks man.