now generated gradient code optimizes the inner argmax by replacing predicate with smaller domain