So here is a sentence by Montaigne, I can get the overall meaning of it but I really can not figure out the meaning of "un pareil soin" here, and as for the "de" before "un pareil soin", I think it goes with "désespèrent"? Besides, what exactly does "il advient de" mean? 

The sentence goes like this, I have trouble in uploading pics so I just typed it up. 

"**Il advient du** mariage ce qui se voit aux cages: les oiseaux qui en sont hors désespèrent d'y entrer; et **d'un pareil soin en sortir**, ceux qui sont au-dedans." ----Montaigne

Really thanks hahah