Merge double-nested if into && condition.