-- If pattern -- // block A switch (the_var) { check == 10 { atob(); // block B switch (the_var) { default: { btoc(); } } break; } default: { atoc(); } } // block C -- If-else pattern -- // block A switch (the_var) { check == 15 { // block B switch (the_var) { default: { } } break; } default: { // block C switch (the_var) { default: { } } } } // block D -- Loop + tail pattern -- L0: while(1) { // block A var check = maybe(); switch (the_var) { default: { } } // block B switch (the_var) { check == 41 { break; } default: { break L0; } } } // block C -- Loop with phi to head // code 1 switch (the_var) { default: { var $i_0 = 0;var $x_0 = 5; } } L1: while(1) { // code 2 switch (the_var) { $2 { break; } default: { var $x_1 = $x_0; label = 7; break L1; } } // code 3 switch (the_var) { $6 { break L1; break; } default: { var $i_0 = $7;var $x_0 = $5; } } } if (label == 7) { // code 7 } // code 4 switch (the_var) { $10 { // code 5 switch (the_var) { default: { } } break; } default: { } } // code 6 switch (the_var) { default: { var $x_1 = $13; } } // code 7 -- phi on split dead ends -- // block A................................................................................................... switch (the_var) { chak() { atob(); // block B................................................................................................... switch (the_var) { default: { btod(); } } // block D break; } default: { atoc(); // block C................................................................................................... switch (the_var) { default: { ctod2(); } } // block D } } -- Unbalanced with a dead end -- // block A switch (the_var) { check == 10 { break; } default: { return C; } } while(1) { // block B switch (the_var) { default: { } } // block D switch (the_var) { default: { } } } -- if (expensive || expensive2) X else Y; Z -- // block A L1: do { switch (the_var) { expensive() { label = 3; break; } default: { // block B switch (the_var) { expensive2() { label = 3; break L1; break; } default: { } } // block D switch (the_var) { default: { } } } } } while(0); if (label == 3) { // block C; switch (the_var) { default: { } } } while(1) { // block E switch (the_var) { default: { } } // block F switch (the_var) { default: { } } } -- conditional loop -- // block A L1: do { switch (the_var) { shouldLoop() { while(1) { // block B switch (the_var) { moarLoop() { break; } default: { break L1; } } } break; } default: { } } } while(0); // block C -- If pattern, emulated -- label = 1; L0: while(1) { switch(label|0) { case 3: { // block C break; } case 1: { // block A if (check == 10) { atob(); label = 2; continue L0; } else { atoc(); label = 3; continue L0; } break; } case 2: { // block B switch (b_check()) { case 17: { btoc(); label = 3; continue L0; break; } default: { label = 1; continue L0; } } break; } } } -- If pattern, emulated, using MakeOutputBuffer -- label = 1; L0: while(1) { switch(label|0) { case 3: { // block C break; } case 1: { // block A if (check == 10) { atob(); label = 2; continue L0; } else { atoc(); label = 3; continue L0; } break; } case 2: { // block B switch (b_check()) { case 17: { btoc(); label = 3; continue L0; break; } default: { label = 1; continue L0; } } break; } } } -- If chain (optimized) -- // block A if (a == 10) { // block B } // block C -- If chain (optimized) -- // block A if (a == 10) { // block B if (b == 10) { // block C } } // block D -- If chain (optimized, long) -- // block A if (a == 10) { // block B if (b == 10) { // block C if (c == 10) { // block D } } } // block E