I'm reading CS:APP on Chapter 3 about assembly code. There is a practice problem like this:

In the solution it tells me that
The compiler determines that pointer p always points to x, and hence the expression (*p)+=5 simply increments x. It combines this incrementing by 5 with the increment of y, via the leaq instruction of line 7.
And leaq 5(%rbx,%rcx),%rcxmeansCompute y += x + 5
So I rewrite the C code function according the assembly code like this:
short dw_loop (short x)
{
    short y = x / 9;
    short *p = &x;
    short n = 4 * x;
    do
    {
        y += 5 + x;
        n -= 2;
    } while (n > 0);
    return y;
};
Obviously the result will be different from the original function. So how can I understand that assembly code? I don't know why x+=y;(*p)+=5 can be translated asy+=5+x.

 
    