Buggy code:
public class AssemblyGenerator extends ParaCBaseListener { private Deque < Map < String , Symbol > > symbolTable = new LinkedList < > ( ) ; private Map < RuleContext , String > codeMap = new HashMap < > ( ) ; private Deque < RuleContext > buffersChildren = new LinkedList < > ( ) ; private Integer variableOffset = null ; private int branchCounter = 0 ; private String specialParallelVariableName = null ; private Deque < Map < Interval , Type > > typeCache = new LinkedList < > ( ) ; private static final int INT_SIZE = 4 ; private static final int FLOAT_SIZE = 4 ; private static final int POINTER_SIZE = 4 ; @ Override public void enterProgram ( ProgramContext ctx ) { } @ Override public void exitProgram ( ProgramContext ctx ) { } @ Override public void enterCompoundStatement ( CompoundStatementContext ctx ) { } @ Override public void exitCompoundStatement ( CompoundStatementContext ctx ) { } @ Override public void enterFunctionDefinition ( FunctionDefinitionContext ctx ) { } @ Override public void exitFunctionDefinition ( FunctionDefinitionContext ctx ) { } @ Override public void exitJumpStatement ( JumpStatementContext ctx ) { } @ Override public void enterDeclaration ( DeclarationContext ctx ) { } @ Override public void exitPrimaryExpressionWithIdentifier ( PrimaryExpressionWithIdentifierContext ctx ) { } private void computeArrayIndexLocation ( RuleContext ctx , VariableSymbol variable , int indexStackIndex ) { } @ Override public void exitPrimaryExpressionWithInteger ( PrimaryExpressionWithIntegerContext ctx ) { } @ Override public void exitPrimaryExpressionWithFloat ( PrimaryExpressionWithFloatContext ctx ) { } @ Override public void enterPrimaryExpressionWithCall ( PrimaryExpressionWithCallContext ctx ) { } @ Override public void exitPrimaryExpressionWithCall ( PrimaryExpressionWithCallContext ctx ) { buffersChildren . pop ( ) ; String functionName = ctx . IDENTIFIER ( ) . getText ( ) ; FunctionSymbol functionSymbol = null ; try { functionSymbol = ( ( FunctionSymbol ) ( findSymbol ( functionName ) ) ) ; } catch ( ClassCastException e ) { throw new RuntimeException ( ( "Symbol<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>function<seq2seq4repair_space>for<seq2seq4repair_space>call:<seq2seq4repair_space>" + ( ctx . getText ( ) ) ) ) ; } if ( functionSymbol == null ) throw new RuntimeException ( ( "No<seq2seq4repair_space>such<seq2seq4repair_space>function<seq2seq4repair_space>for<seq2seq4repair_space>call:<seq2seq4repair_space>" + ( ctx . getText ( ) ) ) ) ; if ( ( functionSymbol . parameters . size ( ) ) != ( ctx . expression ( ) . size ( ) ) ) throw new RuntimeException ( ( "Invalid<seq2seq4repair_space>argument<seq2seq4repair_space>count<seq2seq4repair_space>for<seq2seq4repair_space>call:<seq2seq4repair_space>" + ( ctx . getText ( ) ) ) ) ; emit2 ( ctx , "push<seq2seq4repair_space>%ebx" ) ; int size = 0 ; Iterator < VariableSymbol > parameter = functionSymbol . parameters . iterator ( ) ; <START_BUG> for ( int i = ( ctx . getChildCount ( ) ) - 1 ; i >= 0 ; -- i ) { <END_BUG> String code = codeMap . remove ( ctx . getChild ( i ) ) ; if ( code == null ) continue ; emit ( ctx , code ) ; Type type = getCachedType ( ctx . getChild ( i ) ) ; Type wantedType = parameter . next ( ) . type ; if ( ( type == ( Type . INT ) ) && ( wantedType == ( Type . FLOAT ) ) ) castIntToFloat ( ctx ) ; else if ( ( type == ( Type . FLOAT ) ) && ( wantedType == ( Type . INT ) ) ) castFloatToInt ( ctx ) ; else if ( type != wantedType ) throw new RuntimeException ( ( "Wrong<seq2seq4repair_space>argument<seq2seq4repair_space>type<seq2seq4repair_space>for<seq2seq4repair_space>call:<seq2seq4repair_space>" + ( ctx . getText ( ) ) ) ) ; switch ( wantedType ) { case INT : size += AssemblyGenerator . INT_SIZE ; break ; case FLOAT : size += AssemblyGenerator . FLOAT_SIZE ; break ; case INT_POINTER : case FLOAT_POINTER : case INT_ARRAY : case FLOAT_ARRAY : size += AssemblyGenerator . POINTER_SIZE ; break ; } } emit2 ( ctx , ( "call<seq2seq4repair_space>" + ( ctx . IDENTIFIER ( ) . getText ( ) ) ) ) ; emit2 ( ctx , "pop<seq2seq4repair_space>%ebx" ) ; emit2 ( ctx , ( ( "add<seq2seq4repair_space>$" + size ) + ",<seq2seq4repair_space>%esp" ) ) ; emit2 ( ctx , "push<seq2seq4repair_space>%eax" ) ; cacheType ( ctx , functionSymbol . returnType ) ; } @ Override public void exitUnaryExpression ( UnaryExpressionContext ctx ) { } @ Override public void exitBinaryExpression ( BinaryExpressionContext ctx ) { } private void castIntToFloat ( RuleContext ctx ) { } private void castFloatToInt ( RuleContext ctx ) { } @ Override public void exitExpressionWithAssignment ( ExpressionWithAssignmentContext ctx ) { } @ Override public void enterSelectionStatement ( SelectionStatementContext ctx ) { } @ Override public void exitSelectionStatement ( SelectionStatementContext ctx ) { } @ Override public void enterIterationStatement ( IterationStatementContext ctx ) { } @ Override public void exitIterationStatement ( IterationStatementContext ctx ) { } @ Override public void enterParallelIterationStatement ( ParallelIterationStatementContext ctx ) { } @ Override public void exitParallelIterationStatement ( ParallelIterationStatementContext ctx ) { } @ Override public void enterStatement ( StatementContext ctx ) { } @ Override public void exitStatement ( StatementContext ctx ) { } private void ignoreExpressionValue ( ExpressionContext ctx ) { } private void pushSymbolTable ( ) { } private void popSymbolTable ( ) { } private Symbol addSymbol ( Symbol symbol ) { } private FunctionSymbol addFunctionSymbol ( TypeNameContext returnType , DeclaratorContext declarator ) { } private Symbol findSymbol ( String name ) { } private VariableSymbol getVariable ( String name ) { } private VariableSymbol createVariable ( TypeNameContext typeName , DeclaratorContext declarator ) { } private void cacheType ( RuleContext ctx , Type type ) { } private Type getCachedType ( ParseTree ctx ) { } private String newLabel ( ) { } private void emit ( RuleContext ctx , String code ) { } private void emit2 ( RuleContext ctx , String code ) { } private boolean emitBuffered ( RuleContext ctx ) { } private void log ( RuleContext ctx , String message ) { } }

Fix:
for ( int i = 0 ; i < ( ctx . getChildCount ( ) ) ; ++ i ) {