Warner retires in pain after making 200 in 100th Test as South Africa struggle