Let $r_2(n)$ denote the number of ways in which a positive integer $n$ is expressed as the sum of two squares (integers). I would like to know if there is a result that gives the exact behavior of (as $X\to\infty$) $$ \sum_{n\leq X}r_2(n^2+d^2) $$ for a fixed $d\in\mathbb{N}$. I think that it is expected to have the behaviour $A(d)X \log X + B(d) X + ERROR$. I am interested in the constants $A(d)$ and $B(d)$. Do you know if some paper establishes this result?
Thank you very much