optimize SegmentOp with 2 natural literals
optimize other cases of SegmentOp
tests for #345
optimize for loops with SegmentOp for #345