ikudrin added a comment. If I calculate it right, your code has the same cyclomatic complexity as the original one. At the same time, it is one level deeper, taking into account the number of conditions for the particular lines. https://reviews.llvm.org/D50632