This implementation is definitely not optimization of the built-in strcmp, it is simply another implementation and I believe it will most probably perform worse than the built-in version.
A comparison function is supposed to return 0 if the values being compared are equal, any negative number if the first value is smaller and any positive number if the first value is greater. And that is what happens on the last line.
The idea of the last line is to cast the characters to unsigned chars and I believe the author meant for this to sort non-standard characters after the standard ones(ASCII codes 0-127).
EDIT: there is no bug in the code and it can and will return negative values if value pointed to by s1 is smaller than the value pointed to by s2 ordering standard characters before characters with code 128 and above.