Two-loop four-gluon amplitudes in N = 4 super-Yang-Mills