The document discusses how to transform a regular recursive function into a tail recursive function by using abstract syntax trees (ASTs). It provides an example of transforming a factorial function from a regular recursive version to a tail recursive version by passing an accumulator parameter. The algorithm detects which functions are recursive, traverses the AST to find return nodes, and transforms recursive calls by turning them inside out and adding an accumulator with an initial default value.