While the avr-gcc toolset and avr libC is important (actually necessary) and is used to build the code on AVR platforms, Arduino is much bigger than that.
If you use capabilities in avr-gcc that are not part of the Arduino language APIs, like doing AVR port i/o, you are technically not actually writing Arduino code anymore, even if you use the Arduino IDE to compile & build the code.
You are writing code that is a hybrid of Arduino code and avr-gcc code that is not portable to other platforms.
Code that is written for Arduino using the Arduino APIs and strictly conforming to the Arduino APIs will be portable to any processor that has an Arduino core platform.
IMO, that is what much of this thread discussion is about.
There is a distinction between using the Arduino IDE and its environment to build code and actually writing Arduino code.
To write truly portable Arduino code, you need to only use Arduino API functions strictly the way they are documented. i.e. write code using only what the Arduino environment provides - not what a particular build tool may provide.
The original sketch example that kicked off this thread was an example of code that was trying to be strictly portable using the Arduino APIs the way they are defined while at the same time trying to be easy to read and understand.
Can you do things differently, and perhaps generate better/faster code?
Sure, but many of the ways to do that, particularly ones that increase performance by doing things like AVR port i/o are stepping outside of the Arduino environment and hence are not portable and technically is no longer Arduino code.
--- bill