Pergunta de entrevista da empresa Arm

A simple algorithm problem. Dived into assembly level.