Notice the NOP instruction at the end. This serves as a harmless way to attach a label to a do-nothing instruction. If we had a smart compiler or more experienced human assembler programmer, we could have compressed the ENDIF: label into the following statement, which happens to be JMP WHILE: 3: IF: JN ELSE ; if (x > y) 4: THEN: STD X ; x = x - y; 5: JMP ENDIF ; 6: ELSE: LOD Y ; else 7: SUB X ; 8: STD Y ; y = y - x; 9: ENDIF: JMP WHILE ; These kinds of optimizations are very important in compiler design. Such improvements may look tiny and trivial but remember, these sections of code may be executed billions of times each day, so even a 1% reduction in program size or running speed may have significant economic impact. |