Improved the function dispatch to only take the minimum number of branches (via bsearch). There is one additional branch to check that the indexes are within bounds; there is also an early-out for consecutive binary searches due to if's evaluation of the condition clause. Note that the entire dispatch would be much simpler if we would not support non-contiguous index sets (sparse indexes). The Python script already sorted the indexes; a prerequisite for the binary search. The generated source code is now also beautified and more readable.