See https://www.irs.gov/pub/irs-news/fs-08-25.pdf
The amount of the compensation will never exceed the amount received by the shareholder either directly or indirectly. However, if cash or property or the right to receive cash and property did go the shareholder, a salary amount must be determined and the level of salary must be reasonable and appropriate.