How can Inter Miami advance to the Knockout Stage (FIFA Club World Cup)

After all teams in Group A have played two matches, Inter Miami and Palmeiras have four points and occupy spots #1 and #2 in group standings. They play Palmeiras next, while the remaining two teams play each other.

I get that if Inter Miami win or draw against Palmeiras, they advance. If they lose, it will come down to how the match between Al Ahly and Porto shakes out. They draw, and Inter Miami advances. If one team or the other wins, well, here’s where I get confused.

Goal differentials are as follows:

Palmeiras 2
Inter Miami 1
Porto -1
Al Ahly -2

I have no idea how to derive meaning from that. Does Miami’s success or failure depend on how many goals they score? How many the losing team scores in the final? How many the winning team scores?

Someone please help me make sense of this.

I could be wrong, but I believe Inter Miami has to make sure it stays ahead of Porto and Al Ahly in terms of goal differential. So if Inter Miami loses its next game by 1 goal, it must hope that Porto doesn’t win its game by 1 goal, or that Al Ahly doesn’t win its next game by 2 goals.

Advancing out of the group is based on 1) pts 2) goal differential 3) goals scored.

If the other game is a draw it won’t matter if Miami loses. And if Miami loses by 3+ any winner is the offer game will advance. Other than that it’ll depend on the specific score.