I did figure out how to build it and insert debugging statements, but when I tried to duplicate the code that was updating "mPelvisState" with some velocity vectors, to also update a new mHeadState I kept crashing the client.
I thought I understood what was going on as llkeyframewalkmotion:doUpdate was computing both ankle position and the pelvis position. But after staring it for a while, it looks like its just computing the ankle positions to figure out how far the pelvis is going to move in the next frame.
So I downloaded QAvimator and the Second Life BVH files, and determined that yes they used animation files and not code to define how a character walks.
However when I played the official walk animation in QAvimator, and in Second Life, it looks significantly better in QAvimator as the animation is rendering smoothly than the SL viewer. Though even with a better rendering, I think the head flops around too much.
Also I wonder what'd happen if I replaced the LLUUID for ANIM_AGENT_WALK_ADJUST with some random other walk animation. (I was going to try it with one of my purchased animation overrides, but the Copy UUID link was grayed out.