See https://cambium.inria.fr/~maranget/MPRI/03.pdf, slides 30, 63 and 64.