AVR- "Bootloader Main function and Application Main function"
I'd keep them separated.

What you can do is:


Create two programs, your bootloader and your application
Make sure these two programs are linked to different locations (e.g. bootloader to 0x0 (reset vector) and application to 0x20000 (application address).
The bootloader will be started after a reset and immediately after that it will decide if it should start the bootloader routines or if it should branch to the application. Only do what's absolutely necessary to make that decision (the rules for making that decision are up to you; e.g. some special value in flash or a button press).