
This answer draws from the answers within the SO question Algorithm complexity with input is fix-sized
The first thing to do is to rewrite this as pseudo code with line numbers so that we can talk about specific loops.
1) def GCD(x, y):
2) while x != y:
3) if x < y:
4) x, y = ...