Index: src/ControlStruct/MLEMutator.cc
===================================================================
--- src/ControlStruct/MLEMutator.cc	(revision ca35c51743c5aa90ec6fd8bc56f12cfc866101ff)
+++ src/ControlStruct/MLEMutator.cc	(revision adcc065a1f458beaba9f423018e54c98163169d8)
@@ -9,15 +9,14 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Rob Schluntz
-// Last Modified On : Mon Jul 20 13:58:35 2015
-// Update Count     : 176
-//
-
-// NOTE: There are two known subtle differences from the code that uC++
-// generates for the same input
-// -CFA puts the break label inside at the end of a switch, uC++ puts it after
-// -CFA puts the break label after a block, uC++ puts it inside at the end
-// we don't yet know if these differences are important, but if they are then
-// the fix would go in this file, since this is where these labels are generated.
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Jul  6 17:40:02 2016
+// Update Count     : 196
+//
+
+// NOTE: There are two known subtle differences from the code that uC++ generates for the same input
+//   -CFA puts the break label inside at the end of a switch, uC++ puts it after
+//   -CFA puts the break label after a block, uC++ puts it inside at the end
+// It is unclear if these differences are important, but if they are, then the fix would go in this file, since this is
+// where these labels are generated.
 
 #include <cassert>
@@ -38,8 +37,7 @@
 	}
 
-	// break labels have to come after the statement they break out of,
-	// so mutate a statement, then if they inform us through the breakLabel field
-	// tha they need a place to jump to on a break statement, add the break label
-	// to the body of statements
+	// break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
+	// through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the
+	// body of statements
 	void MLEMutator::fixBlock( std::list< Statement * > &kids ) {
 		for ( std::list< Statement * >::iterator k = kids.begin(); k != kids.end(); k++ ) {
@@ -62,6 +60,5 @@
 		} // if
 
-		// a child statement may set the break label
-		// - if they do, attach it to the next statement
+		// a child statement may set the break label - if they do, attach it to the next statement
 		std::list< Statement * > &kids = cmpndStmt->get_kids();
 		fixBlock( kids );
@@ -71,5 +68,5 @@
 			if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {
 				set_breakLabel( enclosingControlStructures.back().useBreakExit() );
-			}
+			} // if
 			enclosingControlStructures.pop_back();
 		} // if
@@ -80,8 +77,7 @@
 	template< typename LoopClass >
 	Statement *MLEMutator::handleLoopStmt( LoopClass *loopStmt ) {
-		// remember this as the most recent enclosing loop, then mutate
-		// the body of the loop -- this will determine whether brkLabel
-		// and contLabel are used with branch statements
-		// and will recursively do the same to nested loops
+		// remember this as the most recent enclosing loop, then mutate the body of the loop -- this will determine
+		// whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested
+		// loops
 		Label brkLabel = generator->newLabel("loopBreak");
 		Label contLabel = generator->newLabel("loopContinue");
@@ -89,10 +85,9 @@
 		loopStmt->set_body ( loopStmt->get_body()->acceptMutator( *this ) );
 
+		Entry &e = enclosingControlStructures.back();
 		// sanity check that the enclosing loops have been popped correctly
-		Entry &e = enclosingControlStructures.back();
 		assert ( e == loopStmt );
 
-		// this will take the necessary steps to add definitions of the previous
-		// two labels, if they are used.
+		// this will take the necessary steps to add definitions of the previous two labels, if they are used.
 		loopStmt->set_body( mutateLoop( loopStmt->get_body(), e ) );
 		enclosingControlStructures.pop_back();
@@ -106,4 +101,24 @@
 
 		return caseStmt;
+	}
+
+	template< typename IfClass >
+	Statement *MLEMutator::handleIfStmt( IfClass *ifStmt ) {
+		// generate a label for breaking out of a labeled if
+		bool labeledBlock = !(ifStmt->get_labels().empty());
+		if ( labeledBlock ) {
+			Label brkLabel = generator->newLabel("blockBreak");
+			enclosingControlStructures.push_back( Entry( ifStmt, brkLabel ) );
+		} // if
+
+		Parent::mutate( ifStmt );
+		
+		if ( labeledBlock ) {
+			if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {
+				set_breakLabel( enclosingControlStructures.back().useBreakExit() );
+			} // if
+			enclosingControlStructures.pop_back();
+		} // if
+		return ifStmt;
 	}
 
@@ -119,12 +134,12 @@
 
 		// only generate break label if labeled break is used
-		if (e.isBreakUsed()) {
-			// for the purposes of keeping switch statements uniform (i.e. all statements that are
-			// direct children of a switch should be CastStmts), append the exit label + break to the
-			// last case statement; create a default case if there are no cases
+		if ( e.isBreakUsed() ) {
+			// for the purposes of keeping switch statements uniform (i.e. all statements that are direct children of a
+			// switch should be CastStmts), append the exit label + break to the last case statement; create a default
+			// case if there are no cases
 			std::list< Statement * > &branches = switchStmt->get_branches();
 			if ( branches.empty() ) {
 				branches.push_back( CaseStmt::makeDefault() );
-			}
+			} // if
 
 			if ( CaseStmt * c = dynamic_cast< CaseStmt * >( branches.back() ) ) {
@@ -132,5 +147,5 @@
 				c->get_statements().push_back( new BranchStmt( temp, Label("brkLabel"), BranchStmt::Break ) );
 			} else assert(0); // as of this point, all branches of a switch are still CaseStmts
-		}
+		} // if
 
 		assert ( enclosingControlStructures.back() == switchStmt );
@@ -152,8 +167,8 @@
 				// labelled continue - lookup label in table ot find attached control structure
 				targetEntry = std::find( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), (*targetTable)[branchStmt->get_target()] );
-			}
+			} // if
 			if ( targetEntry == enclosingControlStructures.rend() || ! isLoop( targetEntry->get_controlStructure() ) ) {
 				throw SemanticError( "'continue' target must be an enclosing loop: " + originalTarget );
-			}
+			} // if
 		} else if ( branchStmt->get_type() == BranchStmt::Break ) {
 			if ( enclosingControlStructures.empty() ) throw SemanticError( "'break' outside a loop, switch, or labelled block" );
@@ -161,9 +176,9 @@
 		} else {
 			assert( false );
-		}
+		} // if
 
 		if ( branchStmt->get_target() != "" && targetTable->find( branchStmt->get_target() ) == targetTable->end() ) {
 			throw SemanticError("The label defined in the exit loop statement does not exist: " + originalTarget );  // shouldn't happen (since that's already checked)
-		}
+		} // if
 
 		// branch error checks, get the appropriate label name and create a goto
@@ -191,5 +206,5 @@
 			delete branchStmt;
 			return new BranchStmt( std::list<Label>(), exitLabel, BranchStmt::Goto );
-		}
+		} // if
 	}
 
@@ -208,11 +223,10 @@
 			std::list< Label > labels; labels.push_back( e.useContExit() );
 			newBody->get_kids().push_back( new NullStmt( labels ) );
-		}
+		} // if
 
 		if ( e.isBreakUsed() ) {
-			// break label goes after the loop -- it'll get set by the
-			// outer mutator if we do this
+			// break label goes after the loop -- it'll get set by the outer mutator if we do this
 			set_breakLabel( e.useBreakExit() );
-		}
+		} // if
 
 		return newBody;
@@ -227,4 +241,8 @@
 	}
 
+	Statement *MLEMutator::mutate( IfStmt *ifStmt ) {
+		return handleIfStmt( ifStmt );
+	}
+
 	Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
 		return handleSwitchStmt( switchStmt );
@@ -234,5 +252,4 @@
 		return handleSwitchStmt( switchStmt );
 	}
-
 } // namespace ControlStruct
 
Index: src/ControlStruct/MLEMutator.h
===================================================================
--- src/ControlStruct/MLEMutator.h	(revision ca35c51743c5aa90ec6fd8bc56f12cfc866101ff)
+++ src/ControlStruct/MLEMutator.h	(revision adcc065a1f458beaba9f423018e54c98163169d8)
@@ -9,7 +9,7 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Rob Schluntz
-// Last Modified On : Wed Jun 03 15:06:36 2015
-// Update Count     : 25
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Jul  6 16:49:52 2016
+// Update Count     : 31
 //
 
@@ -30,4 +30,5 @@
 	class MLEMutator : public Mutator {
 		class Entry;
+		typedef Mutator Parent;
 	  public:
 		MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
@@ -35,11 +36,12 @@
 
 		CompoundStmt *mutate( CompoundStmt *cmpndStmt );
-		Statement *mutate( WhileStmt *whileStmt );
-		Statement *mutate( ForStmt *forStmt );
-		Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError );
+		virtual Statement *mutate( WhileStmt *whileStmt ) override;
+		virtual Statement *mutate( ForStmt *forStmt ) override;
+		virtual Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError ) override;
 
-		Statement *mutate( CaseStmt *caseStmt );
-		Statement *mutate( SwitchStmt *switchStmt );
-		Statement *mutate( ChooseStmt *switchStmt );
+		virtual Statement *mutate( CaseStmt *caseStmt ) override;
+		virtual Statement *mutate( IfStmt *ifStmt ) override;
+		virtual Statement *mutate( SwitchStmt *switchStmt ) override;
+		virtual Statement *mutate( ChooseStmt *switchStmt ) override;
 
 		Statement *mutateLoop( Statement *bodyLoop, Entry &e );
@@ -65,5 +67,4 @@
 			bool isContUsed() const { return contUsed; }
 			bool isBreakUsed() const { return breakUsed; }
-
 		  private:
 			Statement *loop;
@@ -79,4 +80,7 @@
 		template< typename LoopClass >
 		Statement *handleLoopStmt( LoopClass *loopStmt );
+
+		template< typename IfClass >
+		Statement *handleIfStmt( IfClass *switchStmt );
 
 		template< typename SwitchClass >
