Suppose $M$ is a manifold of class $C^2$ and I have a function $f:M\times M \to M$ which lies in $C^2$. I can define a partial derivative such that I differentiate by one argument, e.g. if $\varphi: \mathbb{R}\to M$ such that $X=[\varphi]\in T_pM$, then the derivative w.r.t. the first argument is $df\rvert_p(\cdot,x)(X) = [f(\varphi, x)]$. My question is if something like the Schwarz theorem holds, i.e. do the partial derivatives at a point $(p,p)$ commute? Under which conditions?
My thoughts so far were: Since $f$ is $C^2$, for any maps $\varphi:\tilde{U}\to U$, $\psi:\tilde{V}\to V$ with neighborhoods $\tilde{V}\subset \mathbb{R}^n$, $\tilde{U}\subset \mathbb{R}^{2n}$ and $U\subset M\times M$, $V\subset M$ such that $p\in U$, $f(p)\in V$ and $f(U)\subset V$ the map $$\psi^{-1}\circ f\circ\varphi: \tilde{U}\to \tilde{V}$$ is in $C^2$ on subsets from $\mathbb{R}^{2n}$ to $\mathbb{R}^n$. Hence, the Schwarz theorem is applicable for each component function.
I came across this problem on the proof for the anti-symmetrie of the Lie bracket (Duistermaat), where $f$ is the commutator of the Lie group. There, we have the property that the derivative vanishes which I suspect is a necessary requirement.