Conditional sentences are used to express real and unreal events. The real events are usually true or at least possible. The unreal events are usually hypothetical and can describe what could have happened or what we wish could have happened.
stop + infinitive (to + verb) is used to describe an action that ends so that another action can begin. “James will be late today because he stopped to eat breakfast.”
The past perfect tense is used to describe an action (or event) that happened before another action (or event) happened. The past perfect is formed by combining the past tense of 'have' with the past participle of the verb.