Atmel Studio and Arduino IDE compiles the same code different
I found the solution (or what the problem is). Avrdude not only requires MCU model but also programmer parameter. If you are using any of Arduino based boards you need to add -c programmer id do avrdude input parameters.