Without meeting “S”, I can’t give you an explanation of his behavior. I can only venture a few possibilities: It could be that he feels he deserves the ill treatment. It could be that he for some reason gets something out of the cycle of hurt, forgiveness, good times, hurt, …
It could be that in his eyes, “C” has something he wants that you don’t have. It could be that there is more to his relationship with “C” than you know. Whatever it is, “S” isn’t giving you enough information to understand it and hasn’t asked for your help in dealing with it.
From my point of view, you are asking the wrong question: Your energy would be much better spent investigation why you stick with this friend who isn’t a friend to you and who, in fact, emotionally abuses you. Your relationship seems very one sided, with you always “being there” but “S” putting his attention on “C”. Why are you interested in salvaging a relationship where your love and care isn’t returned? It’s likely that your love will not be reciprocated.
There’s an old saying: “Don’t try to teach a pig to sing. You will only frustrate yourself and make the pig angry.” You aren’t likely to change your friend no matter how well you understand him.
You can change yourself. You deserve so much better than this relationship can give you. Ask yourself why you are willing to put up with “S”. What can be gained by continuing your efforts? I’m sure the answer to this is complicated. If you can’t figure it out on your own, it might be helpful to see the therapists you consulted about “S” to instead talk about yourself.
I urge you to take a huge step away from this so-called friendship. There is no need to get into drama about it. Don’t explain why. Don’t argue. Just stop being available. Then get involved with something where you will meet other people who are about your age and who share your interests. Give yourself the chance to meet other interesting people. With time and the development of friendships, you will eventually find a friend who will give as well as take.
I wish you well.