The compiler generates this code depending on which registers it needs to be preserved in the caller function. So usually r4-r9 are saved and then restored in the end of the function. r0 and r1 may be saved to stack in order to reuse them later.
Ex:
void main(argc, argv)
{
ParseStringArguments(&stringArguments, argc, argv);
ParseNumericArguments(&numericArguments, argc, argv);
}
main will get argc and argv through r0 and r1. Then it will be necessary to call ParseStringArguments. stringArguments will be passed through r0, argc through r1 and argv through r2. So the compiler will have to rewrite r0 and r1 with the new values. Where will it get the values of argc and argv when it comes to the call of ParseNumericArguments? So compiler generates the code to store argc and argv to stack, then load them back right before the call.
LR holds return address. https://en.wikipedia.org/wiki/Link_register function uses it to return to the caller function via
MOV PC, LR
or
BX LR