Growing tree in GLSL with geometry shader

Hi to all. I Faced with the problem of implementing an algorithm for generate trees on a geometry shader.
In the algorithm, I use a method similar to the work of “subdivide”. But I have a problem in building branches.
The logic is work correctly, recursive division works too.But the branches in subsequent division steps grow
only from one branch without capturing the rest that are generated, which is not entirely true.
My question is that perhaps I am missing something that does not allow me to generate a tree.
If you have any suggestions on how to solve the problem with building branches, I will be very grateful.
Thanks for your attention, and I attach file with algorithm below.
tree_mb_subdiv_trouble.1.toe (5.9 KB)