If $p_A(x) = x^4 (x+3)^2 (x-4)$ then $A$ is diagonalizable iff $\operatorname{Rank}(A) + \operatorname{Rank}(-3I-A) = 8$ 
Given the Characteristic polynomial of a matrix $A$ is
  $$
  p(x) = x^4 (x+3)^2 (x-4),
$$
  show that $A$ is diagonalizable if and only if
  $$
  \operatorname{Rank}(A) + \operatorname{Rank}(-3I-A) = 8.
$$


Given: $A$ is diagonalizable
Prove: $\operatorname{Rank}(A) + \operatorname{Rank}(-3I-A) = 8$
(Help is needed in the other way around)
The geometric multiplicity equals the algebraic multiplicity, hence the diagonal matrix $D$ will look like
$$
    D
  = \begin{pmatrix}
      -3  &     &   &   &   &   &   \\
          & -3  &   &   &   &   &   \\
          &     & 4 &   &   &   &   \\
          &     &   & 0 &   &   &   \\
          &     &   &   & 0 &   &   \\
          &     &   &   &   & 0 &   \\
          &     &   &   &   &   & 0 
    \end{pmatrix}
$$
Since $D$ and $A$ are similar matrices, their rank must be the same:
$$
 \operatorname{Rank}(A) = \operatorname{Rank}(D) = 3.
$$
Also
$$
    -3I - A
  = \begin{pmatrix}
      0 &   &     &   &     &     &     \\
        & 0 &     &   &     &     &     \\
        &   & -7  &   &     &     &     \\
        &   &     & 0 &     &     &     \\
        &   &     &   & -3  &     &     \\
        &   &     &   &     & -3  &     \\
        &   &     &   &     &     & -3 
    \end{pmatrix}
$$
and therefore
$$
    \operatorname{Rank}(A) + \operatorname{Rank}(-3I-A)
  = 3 + 5
  = 8.
$$
Perfect.
(Is it okay to place $D$ instead of $A$ in $\operatorname{Rank}(-3I-A)$? The rank will be the same, is it not?)

Given: $\operatorname{Rank}(A) + \operatorname{Rank}(-3I-A) = 8$
Prove: $A$ is diagonalizable
No clue really…
I was thinking since geometric multiplicity is less or equal to algebraic multiplicity, I was thinking of finding all possible $D$'s and show that the one that makes the statement $\operatorname{Rank}(A) + \operatorname{Rank}(-3I-A) = 8$ hold makes $A$ diagonal.
Any hint is appreciated.

Look at the possible Jordan form of $A$ 
$$
\begin{bmatrix}
-3 & * & 0 & 0 & 0 & 0 & 0\\
0 & -3 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 4 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 0 & * & 0 & 0\\
0 & 0 & 0 & 0 & 0 & * & 0\\
0 & 0 & 0 & 0 & 0 & 0 & *\\
0 & 0 & 0 & 0 & 0 & 0 & 0
\end{bmatrix}
$$
(* elements are $0$ or $1$) to deduce that 


*

*$\operatorname{rank}A\ge 3$ and
$\operatorname{rank}A=3$ $\iff$ the block with eigenvalue $0$ is diagonal.

*$\operatorname{rank}(-3I-A)\ge 5$ and
$\operatorname{rank}(-3I-A)=5$ $\iff$ the block with eigenvalue $-3$ is diagonal.


Therefore, $\operatorname{rank}A+\operatorname{rank}(-3I-A)\ge 8$ and $\operatorname{rank}A+\operatorname{rank}(-3I-A)=8$ $\iff$ $\operatorname{rank}A=3$, $\operatorname{rank}(-3I-A)=5$. Then...
P.S. To answer your question "is it ok to place $D$ instead of $A$ in $\operatorname{rank}(-3I-A)$": yes, it is ok, since $-3I-A$ and $-3I-D$ are similar as well
$$
\lambda I-A=\lambda I-SDS^{-1}=\lambda SS^{-1}-SDS^{-1}=S(\lambda I-D)S^{-1}.
$$
