autosmp: optimize the nested if statements