I am reading a book on the linear complementarity problem (LCP) that claims that the necessary KKT conditions for the problem
\begin{align} \text{minimize} \quad &z^T(q + Mz) \\ \text{subject to} \quad &q + Mz \geq 0 \\ & \quad z \geq 0 \end{align}
are given by
\begin{align} q + (M+M^T)z^* - M^Tu^* &\geq 0 \\ (z^*)^T(q + (M + M^T)z^* - M^Tu^* &= 0 \\ u^* &\geq 0 \\ (u^*)^T(q+Mz^*)&=0 \end{align}
where $z^*$ is an optimal solution and $u^*$ is a suitable vector of multipliers.
Can someone please explain how these are derived?
My understanding is that the necessary KKT conditions for the problem
\begin{align} \text{minimize} \quad &f(x) \\ \text{subject to} \quad &g_i(x) \leq 0 \quad \text{for } i \in \{1, \dots, m\}\\ & h_i(x) = 0 \quad \text{for } i \in \{1, \dots, l\} \end{align}
are given by
\begin{align} \nabla f(\bar{x}) + \sum_{i=1}^{m} u_i \nabla g_i(\bar{x}) + \sum_{i=1}^{l} v_i \nabla h_i(\bar{x}) = 0 \\ u_i g_i(\bar{x}) = 0 \quad \text{for } i \in \{1, \dots, m\} \\ u_i \geq 0 \quad \text{for } i \in \{1, \dots, m\} \end{align}
where $\bar{x}$ is an optimal solution, and $u_i$ and $v_i$ are unique scalars.