Program: 83847
Project: 83847
Buggy source:
@Override public void writeStatement(MethodWriter writer){
  org.objectweb.asm.Label startLabel=this.startLabel.target;
  org.objectweb.asm.Label updateLabel=this.updateLabel.target;
  org.objectweb.asm.Label endLabel=this.endLabel.target;
  Variable var=this.variable;
  if (this.type == DEFAULT) {
    if (var != null) {
      var.value.writeExpression(writer);
      var.index=writer.registerLocal(var.type);
      writer.writeVarInsn(var.type.getStoreOpcode(),var.index);
    }
    writer.writeFrameLabel(startLabel);
    if (this.condition != null) {
      this.condition.writeInvJump(writer,endLabel);
    }
    if (this.then != null) {
      this.then.writeStatement(writer);
    }
    writer.writeLabel(updateLabel);
    if (this.update != null) {
      this.update.writeStatement(writer);
    }
    writer.writeJumpInsn(Opcodes.GOTO,startLabel);
    writer.removeLocals(1);
    writer.writeFrameLabel(endLabel);
    if (var != null) {
      writer.writeLocal(var.qualifiedName,var.type,startLabel,endLabel,var.index);
    }
    return;
  }
  if (this.type == ARRAY) {
    Variable arrayVar=this.var3;
    Variable indexVar=this.var1;
    Variable lengthVar=this.var2;
    org.objectweb.asm.Label scopeLabel=new org.objectweb.asm.Label();
    writer.writeLabel(scopeLabel);
    var.value.writeExpression(writer);
    var.index=writer.registerLocal(MethodWriter.TOP);
    indexVar.index=writer.registerLocal(MethodWriter.INT);
    lengthVar.index=writer.registerLocal(MethodWriter.INT);
    arrayVar.index=writer.registerLocal(arrayVar.type);
    writer.writeInsn(Opcodes.DUP);
    arrayVar.writeSet(writer,null,null);
    writer.writeInsn(Opcodes.ARRAYLENGTH);
    lengthVar.writeSet(writer,null,null);
    writer.writeLDC(0);
    indexVar.writeSet(writer,null,null);
    writer.writeJumpInsn(Opcodes.GOTO,updateLabel);
    writer.writeFrameLabel(startLabel);
    arrayVar.writeGet(writer,null);
    indexVar.writeGet(writer,null);
    writer.writeInsn(arrayVar.type.getArrayLoadOpcode());
    var.writeSet(writer,null,null);
    if (this.then != null) {
      this.then.writeStatement(writer);
    }
    writer.writeIINC(indexVar.index,1);
    writer.writeFrameLabel(updateLabel);
    indexVar.writeGet(writer,null);
    lengthVar.writeGet(writer,null);
    writer.writeJumpInsn(Opcodes.IF_ICMPLT,startLabel);
    writer.removeLocals(4);
    writer.writeFrameLabel(endLabel);
    writer.writeLocal(var.qualifiedName,var.type,scopeLabel,endLabel,var.index);
    writer.writeLocal("String_Node_Str","String_Node_Str",null,scopeLabel,endLabel,indexVar.index);
    writer.writeLocal("String_Node_Str","String_Node_Str",null,scopeLabel,endLabel,lengthVar.index);
    writer.writeLocal("String_Node_Str",arrayVar.type,scopeLabel,endLabel,arrayVar.index);
    return;
  }
}

Fixed version (ground truth):
@Override public void writeStatement(MethodWriter writer){
  org.objectweb.asm.Label startLabel=this.startLabel.target;
  org.objectweb.asm.Label updateLabel=this.updateLabel.target;
  org.objectweb.asm.Label endLabel=this.endLabel.target;
  Variable var=this.variable;
  if (this.type == DEFAULT) {
    int locals=writer.localCount();
    if (var != null) {
      var.value.writeExpression(writer);
      var.index=writer.registerLocal(var.type);
      writer.writeVarInsn(var.type.getStoreOpcode(),var.index);
    }
    writer.writeFrameLabel(startLabel);
    if (this.condition != null) {
      this.condition.writeInvJump(writer,endLabel);
    }
    if (this.then != null) {
      this.then.writeStatement(writer);
    }
    writer.writeLabel(updateLabel);
    if (this.update != null) {
      this.update.writeStatement(writer);
    }
    writer.writeJumpInsn(Opcodes.GOTO,startLabel);
    writer.resetLocals(locals);
    writer.writeFrameLabel(endLabel);
    if (var != null) {
      writer.writeLocal(var.qualifiedName,var.type,startLabel,endLabel,var.index);
    }
    return;
  }
  if (this.type == ARRAY) {
    int locals=writer.localCount();
    Variable arrayVar=this.var3;
    Variable indexVar=this.var1;
    Variable lengthVar=this.var2;
    org.objectweb.asm.Label scopeLabel=new org.objectweb.asm.Label();
    writer.writeLabel(scopeLabel);
    var.value.writeExpression(writer);
    var.index=writer.registerLocal(MethodWriter.TOP);
    indexVar.index=writer.registerLocal(MethodWriter.INT);
    lengthVar.index=writer.registerLocal(MethodWriter.INT);
    arrayVar.index=writer.registerLocal(arrayVar.type);
    writer.writeInsn(Opcodes.DUP);
    arrayVar.writeSet(writer,null,null);
    writer.writeInsn(Opcodes.ARRAYLENGTH);
    lengthVar.writeSet(writer,null,null);
    writer.writeLDC(0);
    indexVar.writeSet(writer,null,null);
    writer.writeJumpInsn(Opcodes.GOTO,updateLabel);
    writer.writeFrameLabel(startLabel);
    arrayVar.writeGet(writer,null);
    indexVar.writeGet(writer,null);
    writer.writeInsn(arrayVar.type.getArrayLoadOpcode());
    var.writeSet(writer,null,null);
    if (this.then != null) {
      this.then.writeStatement(writer);
    }
    writer.writeIINC(indexVar.index,1);
    writer.writeFrameLabel(updateLabel);
    indexVar.writeGet(writer,null);
    lengthVar.writeGet(writer,null);
    writer.writeJumpInsn(Opcodes.IF_ICMPLT,startLabel);
    writer.resetLocals(locals);
    writer.writeFrameLabel(endLabel);
    writer.writeLocal(var.qualifiedName,var.type,scopeLabel,endLabel,var.index);
    writer.writeLocal("String_Node_Str","String_Node_Str",null,scopeLabel,endLabel,indexVar.index);
    writer.writeLocal("String_Node_Str","String_Node_Str",null,scopeLabel,endLabel,lengthVar.index);
    writer.writeLocal("String_Node_Str",arrayVar.type,scopeLabel,endLabel,arrayVar.index);
    return;
  }
}