Compute the smallest value $C$ such that the inequality $$x^2(1+y)+y^2(1+x)\le \sqrt{(x^4+4)(y^4+4)}+C$$ holds for all real $x$ and $y$.
To find the smallest value \( C \) such that the inequality 
\[ x^2(1+y) + y^2(1+x) \leq \sqrt{(x^4+4)(y^4+4)} + C \]
holds for all real \( x \) and \( y \), we can proceed as follows:

1. **Assume \( x = y \):**
   \[ x^2(1+x) + x^2(1+x) = 2x^2(1+x) \]
   \[ \sqrt{(x^4+4)(x^4+4)} = \sqrt{(x^4+4)^2} = x^4 + 4 \]
   The inequality becomes:
   \[ 2x^2(1+x) \leq x^4 + 4 + C \]

2. **Simplify the inequality:**
   \[ 2x^2(1+x) \leq x^4 + 4 + C \]
   \[ 2x^3 + 2x^2 \leq x^4 + 4 + C \]
   \[ x^4 - 2x^3 - 2x^2 + 4 \geq -C \]
   \[ -x^4 + 2x^3 + 2x^2 - 4 \leq C \]

3. **Find the maximum value of the expression \( -x^4 + 2x^3 + 2x^2 - 4 \):**
   To find the maximum value, we take the derivative and set it to zero:
   \[ f(x) = -x^4 + 2x^3 + 2x^2 - 4 \]
   \[ f'(x) = -4x^3 + 6x^2 + 4x \]
   \[ f'(x) = -2x(2x^2 - 3x - 2) \]
   \[ f'(x) = -2x(2x+1)(x-2) \]

4. **Find critical points:**
   Set \( f'(x) = 0 \):
   \[ -2x(2x+1)(x-2) = 0 \]
   \[ x = 0, \quad x = -\frac{1}{2}, \quad x = 2 \]

5. **Evaluate \( f(x) \) at critical points:**
   \[ f(0) = -0^4 + 2 \cdot 0^3 + 2 \cdot 0^2 - 4 = -4 \]
   \[ f\left(-\frac{1}{2}\right) = -\left(-\frac{1}{2}\right)^4 + 2\left(-\frac{1}{2}\right)^3 + 2\left(-\frac{1}{2}\right)^2 - 4 \]
   \[ = -\frac{1}{16} - \frac{1}{4} + \frac{1}{2} - 4 = -\frac{1}{16} - \frac{1}{4} + \frac{8}{16} - 4 \]
   \[ = -\frac{1}{16} - \frac{4}{16} + \frac{8}{16} - 4 = \frac{3}{16} - 4 = \frac{3}{16} - \frac{64}{16} = -\frac{61}{16} \approx -3.8125 \]
   \[ f(2) = -2^4 + 2 \cdot 2^3 + 2 \cdot 2^2 - 4 \]
   \[ = -16 + 16 + 8 - 4 = 4 \]

6. **Determine the maximum value:**
   The maximum value of \( -x^4 + 2x^3 + 2x^2 - 4 \) is 4, which occurs at \( x = 2 \).

Therefore, the smallest value of \( C \) such that the inequality holds for all real \( x \) and \( y \) is \( C = 4 \).

The final answer is \( \boxed{4} \).