Day 4 of Advent of Compiler Optimisations!
Multiply by 2, 3, 4, 16, 25—which ones use the actual multiply instruction? Spoiler: fewer than you think! The compiler has a bag of tricks for avoiding multiplication, using shifts, adds, and that versatile LEA instruction. But when you outsmart it with your own shift-and-add... it un-optimises you right back!
Read more: https://xania.org/202512/04-multiplying-integers
Watch: https://youtu.be/1X88od0miHs