GCC sometimes has trouble to fully optimize code inside the main
function -- simply renaming your function will give fully optimized code
(I'm not sure whether that is a known issue or a "feature" of GCC).
Also, once you sufficiently tested your code, you should compile with
`-DNDEBUG` to disable assertions.
Comparison:
https://godbolt.org/z/ujpwVU
Thanks a lot, Christoph! Yeah that makes a big difference - I'll be sure to keep that in mind when playing with the compiler explorer, guess I was too quick in my assumptions this time..
Best regards,
Ola