Compilers, refactoring tools and program analyzers all have to transform input program directed acyclic graphs to intermediate representation which is easier to use for consequent analysis. This process is not trivial for non-bijective mappings. The main reason is in syntax constructions changing the program's control flow graph, e.g. lambda-functions, statement-expressions, and so on. For the right transformation, the developers are ought to take account of them and adjust expressions depending on them. In this paper, we present an algorithm for translating a directed acyclic graph of programs to derivative intermediate representation with control flow graph manipulation in mind. It is based on a depth-first search with multi-stage processing of syntax nodes. This approach allows eliminating translation in cases when it is not necessary, reducing system resource footprint. During testing, we found that not count but traits of processed syntax nodes affect the performance the most, and that gives evidence of