9. As shown in Figure 5, in $\triangle A B C$, $\angle A C B=90^{\circ}, A C$ $=B C=4, D$ and $E$ are the midpoints of $A C$ and $B C$ respectively. The quadrilateral $A B E D$ is translated to the right along the ray $A B$ to form quadrilateral $P Q R S$. Let $A P=m(0<m<4 \sqrt{2})$. Denote the area of the overlapping part of $\triangle A B C$ and quadrilateral $P Q R S$ during the translation as $y$. Then, the expression for $y$ in terms of $m$ can be written as
9. $y=\left\{\begin{array}{ll}6-\sqrt{2} m, & 0<m \leqslant 2 \sqrt{2} \\ \frac{1}{4} m^{2}-2 \sqrt{2} m+8, & 2 \sqrt{2}<m<4 \sqrt{2}\end{array}\right.$