Atmega pin designation

On the pinout diagram of an ATmega328 I see A0 as it is labeled on the Arduino board, is IDE pin 14. How do you know which to use in the code? I have always struggled with this, and I can't seem to find anywhere that this is clarified.

If I write int LED = 3, how does the IDE know whether I mean A3(physical pin 26, IDE pin 17) or IDE pin 3 (physical pin 5) ??

If you write 'int LED = 3', the compiler (not IDE) has no idea what in hardware you are referring to, just that you have a variable called LED which is assigned the value 3.

If you do this:
digitalRead(3);
Then the compiler still has no idea what hardware you are referring to, it simply calls the function digitalRead(). The function then reads a pointer from the flash which it uses to write to the correct hardware register.

The pointer in the flash is where the magic happens, and this is all defined in the pins_arduino.h file.

A0/D14 - Use A0 when you want to do analogRead.
Use D14 when you want to do digitalRead or digitalWrite.

If you look at pins_arduino.h, that tells the code the mapping from PortD bit 3, to D3 as an example.
The physical package pin # is different between surface mount and through hole package, the software does not know which package it is running on. Purchased boards are labelled with D3 so you don't need to look that up every time. If making your own board, or running a standalone chip, you have to be aware of that.
There are pictures around showing the physical pin mapping.

Awesome, thanks for the replies!

So just to make sure I get it:
If int LED = 3 and I digitalWrite(LED, HIGH) physical pin 5 goes high,
but if LED = 3 and I analogRead(LED) it will measure voltage on physical pin 26.

Physical pin depends on the package.
Will be different between Uno and Promini/Nano for example.

But otherwise Yes, you have the concept correct.
digitalRead/Write of (3) is on a different pin than analogRead(3).

Great, thanks! I guess I should have posted the diagram of the ATmega328 pinout that I am looking at.