---------------------------------------------- a2if Conditional Jumps and Control Flow Graphs ---------------------------------------------- 1 bool LeapYear(unsigned int Year) | 2 { | 3 |LeapYear (unsigned int Year) 4 |{ 5 bool Leap; | 6 | unsigned int D.1589; 7 | unsigned int D.1592; 8 | unsigned int D.1595; 9 | unsigned int D.1601; 10 | unsigned int Leap; 11 if(Year % 4 == 0) { | 12 | D.1589 = Year & 3; 13 | if (D.1589 == 0) goto ; else goto ; 14 if(Year % 100 == 0) { | 15 | : 16 | D.1592 = Year % 100; 17 | if (D.1592 == 0) goto ; else goto ; 18 if(Year % 400 == 0) { | 19 | : 20 | D.1595 = Year % 400; 21 | if (D.1595 == 0) goto ; else goto ; 22 Leap = true; | 23 | : 24 | Leap = 1; 25 | goto ; 26 } else { | 27 Leap = false; | 28 | : 29 | Leap = 0; 30 } | 31 | : 32 | goto ; 33 } else { | 34 Leap = true; | : 35 | Leap = 1; 36 } | 37 | : 38 | goto ; 39 } else { | 40 Leap = false; | 41 | : 42 | Leap = 0; 43 } | 44 return Leap; | 45 | : 46 | D.1601 = Leap; 47 | return D.1601; 48 } | 49 |} 1 Labels have been introduced to denote the program points inside and after if-blocks. These labels are named in a manner similar to that of the temporary local variables generated in the previous assignment (e.g. D.1593). A conditional statement is translated into a one-line GIMPLE statement that performs a conditional jump to either of two labels using gotos. Unconditional gotos are introduced at the end of the code within an if-block to represent a jump out of the block to the remaining code. 2 The CFG dumps are much easier to read as the code is partitioned into basic blocks. A basic block is a portion of code that is always executed sequentially. Control transfer to a basic block can only be to its first statement while that out of a basic block can only be from its last statement. Optional: Can you think of an algorithm to identify basic blocks in 004t.gimple dumps?