To be clear, the official role of HR is to protect the company, which objectives are defined by the owners, represented by the board, not the CEO. Goals of the CEO and the board may align, but they may not, in that latter case a non-corrupt HR function sides with the board. At the end of the day, the CEO is just another employee.