Fix an integer $k >0 $ and would like to know the maximum number of different ways that a number $n$ can be expressed as a sum of $k$ squares, i.e. the number of integer solutions to $$ n = x_1^2 + x_2^2 + \dots + x_k^2$$ with $x_1 \ge x_2 \ge \dots \ge x_k$ and $x_i \ge 0$ for every $i$.

What I'd really like to know about is the asymptotics as $n \to \infty$.

I asked a number theorist once about the case $k=2$, and if I remember correctly, he said that there are numbers $n$ which can be expressed as a sum of two squares in at least $$n^{c/\log \log n}$$ different ways, for some constant $c > 0$, and this is more-or-less best possible. This is the kind of answer I am seeking for larger $k$.

**Clarification:**

What I mean by *maximum* is the following. I want functions $f_k(x)$, as large as possible, such that there exists some sequence of integers $\{ a_i \}$ with $a_i \to \infty$,
and such that $a_i$ can be written as the sum of $k$ squares in at least $f_k(a_i)$ ways.