So it's running time is O(N^4)?

I was messing with it a little, but couldn't do anything definitive.

BTW, what is this loop doing?

for (n = m; n > 0; n -= 1)

;