The first "could" seems a counterfactual connotation, while the second is a hypothetical or counterfactual connotation.
Do you think the 3rd "could" in 2 is same as the first or the second?
1. If I could fly like a bird, I could fly to you.
2. (To a friend who betrayed me, and who has never been thought to do so) - How could you do this to me?(surprise or disbelief for the present situation)