Here what happens with optimizations: https://godbolt.org/z/G18zd7chP
Look at the registers usages vs stack