I don't see any details about the machine but there is a small clue in your post.
"Sometimes it restarts multiple times before even getting to the desktop"
There is an ongoing epidemic of TWO things that I see cause this. But remember I have only what you posted to work with.
1. BAD CAPS. Google that to learn what to look for.
2. An overtaxed power supply. Until the machine details are known these are the two most common causes.
3. The home built machine with pre-applied or stock heatsink compound. Some builders thought it was optional.
I strongly suggest you reply to your top post with all the machine details.