Derivative of $\arcsin(\cos(x))$ at $x=0$. We have to differentiate this function at $x=0$
$$\left. \dfrac{d \arcsin (\cos (x))}{dx} \right|_{x=0}$$
Using the identity $\cos x=\sin \Big(\dfrac{\pi}{2}-x\Big)$ we get
$$\left. \dfrac{d \arcsin (\sin (\dfrac{\pi}{2} - x))}{dx} \right|_{x=0},$$
For $0 \le x \le \pi$. We know
$\arcsin \Big(\sin \Big(\dfrac{\pi}{2}-x\Big)\Big)=\dfrac{\pi}{2}-x$.
So, our original problem reduces to
$$\left. \dfrac{d\Big(\dfrac{\pi}{2}-x\Big)}{dx}\right|_{x=0},$$
which is equal to $-1$ for $0 \le x \le \pi$. 
But the derivative of this function at $x=0$ is undefined. What's going on here?
 A: Near zero you have
$$\arcsin(\cos x) = \frac{\pi}{2} - \arccos(\cos x) = \frac{\pi}{2} - |x|$$
(so the derivative is $+1$ for $x<0$ and $-1$ for $x>0$). And therefore the function cannot be approximated by a linear function in a arbitrary small interval containg $0,$ and this implies that the derivative at $x=0$ does not exist.
Edit: Near $x = 0$ you have $\arccos(\cos x)=|x|$ because $\cos(x)$ is an even function. It cannot be just $x$ because the value is positive for $x\ne0$.
You also have to look at values $x<0,$ if you want to know whether the function has a derivative in a neighborhood of $0$ (it has, if the left and rights derivatives exist and are equal, see e.g. here).
A: The derivative of the function, for $x\ne0$, is
$$
-\frac{\sin x}{\sqrt{1-\cos^2x}}=-\frac{\sin x}{\lvert\sin x\rvert}
$$
By l'Hôpital,
$$
\lim_{x\to0^+}\frac{\arcsin(\cos x)-\arcsin(\cos0)}{x}=
\lim_{x\to0^+}-\frac{\sin x}{\lvert\sin x\rvert}=-1
$$
and, similarly, the limit from the left is $1$.
Thus the limit of the difference quotient doesn't exist.

If we limit the function to the interval $(-\pi/2,\pi/2)$, we have that
$$
f'(x)=\begin{cases}
1 & -\pi/2<x<0 \\[4px]
-1 & 0<x<\pi/2
\end{cases}
$$
so that
$$
f(x)=\begin{cases}
x+c_- & -\pi/2<x<0 \\[4px]
-x+c_+ & 0<x<\pi/2
\end{cases}
$$
for some constants $c_-$ and $c_+$; continuity at $0$ and $f(0)=\pi/2$ gives $c_-=c_+\pi/2$.
Now it should be clear what's your mistake: the equality
$$
\arcsin(\sin(\pi/2-x)=\pi/2-x
$$
doesn't hold for all $x$.

