At first I thought the super-optimizer had made a mistake because the results are not the same but I think the error is in the original where line 6 should be
return -1;
Anyway, using assembler for CPU I made up in my head just now, how about
shl r0,1
and r0,1