Let Xi>max0 in the first comparison, then your function updates max0 to Xi
Consequently, Xi is no longer greater than max0 in the second comparison and max1 does not get updated.