A covered call basically means that the security will be called away from you if the price goes over the strike price. When that happens, you will receive the strike price for your call, and you will hand over the underlying stock to your counterparty. Therefore, the highest price YOU can receive for the stock position is the strike price, X, no matter how high the underlying moves.
Profit from the call position: X - S0, because you bought at S0 and effectively sold it at X.
But that’s not your total profit, since you got paid a premium for selling the call. That premium is CO. Total profit is both from the sale of the security and from the premium.
Total Max Profit = (X - S0) + CO
If the call isn’t exercised, i.e. ST < X, then your profit (or loss) is the difference in the begin and end prices for the underlying, plus the premium for selling the option. The option premium is a realized gain, whereas the stock gain (or loss) does not have to be realized at option expiration if you don’t want to.
Total Profit if ST