This is a good question whose answer changed in 2014.
Only countries C1 and C2 have jurisdiction. Neither state S nor California do unless services were performed there or the contract was entered into there or the company with which you have a contract (and not a mere subsidiary) has a contract there.
Who has jurisdiction in such case of violation of contract? The court
in country C1/C2, state S, or California?
C1 has jurisdiction because the contract was performed in part there and because the defendant is based there.
C2 has jurisdiction because the contract was performed in part there.
State S would have jurisdiction only if the contract were entered into there.
Until recently, California would have jurisdiction because under the traditional rule of the International Shoe case of the U.S. Supreme Court, a company was subject to jurisdiction on any matter in every state where it had a regular office for the conduct of business.
A recent U.S. Supreme Court decision, Daimler A.G. v. Bauman, 134 S. Ct. 746 (2014), limited that rule, holding that a company can be sued on any matter only where it is "at home" (i.e. has a headquarters or near equivalent secondary headquarters, or if it is organized under that jurisdiction's laws), and otherwise can only be sued in a place that has a significant connection to the subject-matter of the particular lawsuit.
Another way of getting jurisdiction over a corporation in a state, called "tag jurisdiction" which involves serving process on the company in the state, was eliminated for corporations in the 9th Circuit, which includes California, in the case of Martinez v. Aero Caribbean (9th Cir. August 21, 2014).
Neither does designation of an agent for service of process in the state. King v. Am. Family Mut. Ins. Co., 632 F.3d 570, 579 (9th Cir. 2011), held that a corporation’s designation of an agent for in-state service of process does not create general jurisdiction over the corporation, even though there has been a widespread view that this was precisely the purpose behind requiring corporations to do so in order to obtain permission to do business in a state.
Another recent U.S. Supreme Court decision held that that a company is not subject to suit in a jurisdiction merely because it has a subsidiary that does business there.
So, under this new line of cases, the California courts would probably not have jurisdiction over the case.
Federal courts in California would also not have jurisdiction over the case since it does not involve a federal issue and does not involve a dispute in excess of $75,000.
Note also that the analysis for limited liability companies and limited partnerships and REITs is different from that for corporations. In non-corporation entities, the company may be sued in any jurisdiction in which an owner of the company resides.
If California courts might have jurisdiction, will a small claims
court have jurisdiction? I.e. does the fact that this involves a
foreign controlled company, even though it is also incorporated in the
US, change anything?
If California court did have jurisdiction (e.g. because the contract also called for performance of work in California as well as C1 and C2), a small claims court would probably have jurisdiction.
If you had a contract with a foreign controlled company that was incorporated in the U.S. (a well known example of such a company would be the franchisor of the 7-11 chain of convenience stores along with its company owned stores) then you could sue in the U.S. state where it was incorporated on any matter.
But, if your contract was with the foreign holding company, rather than a U.S. incorporated subsidiary, then California courts would probably not have jurisdiction over it.