Mystery procedure

Can you work out what this procedure is doing?

Problem

 


What does this procedure do? Prove it.

 

 

Image
Mystery Procedure