Only way Miami don't advance is if Al Ahly beat Porto and Miami lose to Palmeiras, and there's a 3/4 goal swing in the two games.
Porto are probably out because they need to win and hope Miami beat Palmeiras, and have a 3/4 goal swing.
Technically Palmeiras and Miami could play out a draw and...