gcc test/test1.cpp -o bin/test1.exe -I include -Wall -Wextra -g -std=c++11 -lstdc++
No "explicit" optimization is being done, and I am passing the -g flag for debug symbols. One moment I will try compiling with optimization for both programs.
both programs with the flag -g removed and the flag -Os (or -O1) produce the same assembly, so this is probably something to do with the debugging flag? -g it also reduces the assembly down to like 3~4 lines.
EDIT2: just checked without optimization and the debugging flag, its a similar story to the OP.