Branch prediction is not the only reason this is faster and probably not even the biggest reason.
Since the array is sorted,
if (data[c] >= 128)
will evaluate to true consecutively. When the cache requests something from memory, it will request blocks containing multiple words at a time. Since every data[c] that needs to be added to sum is in a contiguous piece of memory, the code is minimizing the number of times a block is transferred from memory to the cache. This is the concept of spatial locality[1].[1]http://en.wikipedia.org/wiki/Locality_of_reference#Locality_...