https://github.com/google/heir/blob/8f23ac0147503094e61b8c229634b85c2d33f399/lib/Transforms/ConvertToCiphertextSemantics/AssignLayout.cpp#L431 Instead of nested for loops - which will make the code nicer to read and more succinct and probably more easily canonicalized.