getting started with programming Arduino board in C/embedded c
Not an exhaustive answer, but one step would be to realize what the Arduino IDE does behind the scenes before it gives your source code to avr-gcc.

From https://github.com/arduino/arduino/wiki/build-process#pre-processing


  The Arduino environment performs a few transformations to your sketch
  before passing it to the avr-gcc compiler:
  
  
  All .ino files in the sketch folder (shown in the IDE as tabs with no    extension) are concatenated together, starting with the
  file that    matches the folder name followed by the others in
  alphabetical order,    and the .cpp extension is added to the
  filename.
  If not already    present, #include &lt;Arduino.h&gt; is added to the sketch. This header    file (found in the core folder for the
  currently selected board)    includes all the definitions needed for
  the standard Arduino core.
  Prototypes are generated for all function definitions in .ino files    that don't already have prototypes. In some rare cases
  prototype    generation may fail for some functions. To work around
  this, you can    provide your own prototypes for these functions.
  #line directives are added to make warning or error messages reflect the original sketch layout.
  
  
  No pre-processing is done to files in a sketch with any extension
  other than .ino. Additionally, .h files in the sketch are not
  automatically #included from the main sketch file. Further, if you
  want to call functions defined in a .c file from a .cpp file (like
  one generated from your sketch), you'll need to wrap its declarations
  in an extern "C" {} block that is defined only inside of C++ files.


This is handy to know if you are trying to port Arduino sketches to pure avr-gcc.

You'll also want to have the header files that define all the various registers specific to the ATMega328p that is the heart of several of the Arduino boards. They can be downloaded as part of Atmel Studio 7, which also includes avr-gcc and the various other toolchain utilities and scripts necessary.

You'll also want the processor's reference manual or datasheet. At this time, the data sheet is available at https://www.microchip.com/wwwproducts/en/ATmega328P in the "Documents" tab. This will lay out everything you ever need to know about how to use the processor, set up peripherals, rules for the order of commands, names of all the registers, etc.