Counting "simultaneous squares' over the Gaussian integers

Let $n$ be a square-free integer. Then for a given integer $m$, $m$ is a square modulo $n$ if and only if the sum

$$\displaystyle \sum_{d | n} \left(\frac{m}{d}\right) > 0.$$

In fact one can write the indicator function $\Psi(m,n)$, which equals unity if $m$ is a square mod $n$ and zero otherwise, as

$$\Psi(m,n) = \frac{1}{2^{\omega(n)}} \sum_{d | n} \left(\frac{m}{d}\right).$$

In both instances $\left(\frac{\cdot}{\cdot}\right)$ denotes the Jacobi symbol.

It is a problem of central interest to evaluate the following sum:

$$\displaystyle \sum_{\substack{mn \leq X \\ mn \text{ square-free}}} \Psi(m,n) \Psi(n,m).$$

This sum, for example, is essential to computing the average size of the 4-class group of quadratic fields (E. Fouvry, J. Kluners, On the 4-rank of class groups of quadratic fields, Invent. Math. 167 (2007), 455-513) and the average size of the 2-Selmer group of congruent number curves (D.R. Heath-Brown, The size of Selmer groups for the congruent number problem, Invent. Math 111 (1993), 171-195). This sum can be shown to be of size of order $X$ (see the arguments in the two papers cited above).

It turns out that in some cases one has to consider the following related sum. Let $m,n$ be positive integers such that $m^2 + n^2$ is square-free. Define the function

$$\displaystyle \Phi(m,n) = \begin{cases} 1 & \text{if } p | m^2 + n^2 \Rightarrow \left(\frac{m}{p}\right) = 1 \\ 0 & \text{otherwise}. \end{cases}$$

How does one evaluate the sum

$$\displaystyle \sum_{\substack{m^2 + n^2 \leq X \\ m^2 + n^2 \text{ square-free}}} \Phi(m,n) \Phi(n,m)?$$