The goal of this talk is to present an algorithm which takes a
compact square complex belonging to a special class as input and decides
whether its fundamental group splits as a free product. The special class
is built by attaching tubes to finite graphs in such a way that they
satisfy a nonpositive curvature condition. This construction gives rise to
a rich class of complexes, including, but not limited to, closed surfaces
of positive genus.
The algorithm can be used to deduce the celebrated Stallings theorem for
this special class, as also the well known Grushko decomposition theorem.