Source: https://www.csie.ntu.edu.tw/~acpang/course/asm_2004/slides/chapt_06_PartII.pdf