nus-yam/ex-repair huggingface dataset:
Program: 78216
Project: 78216
Buggy source:
public void compile(String[] args){
  options.compilerArgSolve(args);
  buildAst();
  typeCheck();
  if (options.dumpAst)   dumpAst();
  buildIR();
  if (options.functionInline)   functionInliner();
  if (options.dumpIR)   dumpIR();
  livenessAnalysis();
  allocate();
  codeGenerate();
}

Fixed version (ground truth):
public void compile(String[] args){
  options.compilerArgSolve(args);
  buildAst();
  typeCheck();
  if (options.dumpAst)   dumpAst();
  buildIR();
  if (options.functionInline)   functionInliner();
  livenessAnalysis();
  if (options.dumpIR)   dumpIR();
  allocate();
  codeGenerate();
}
Program: 78217
Project: 78217
Buggy source:
private void eliminate(Function function){
  List<BasicBlock> blocks=function.basicBlocks();
  for (int index=blocks.size() - 1; index >= 0; --index) {
    for (Instruction inst=blocks.get(index).back(); inst != null; inst=inst.prev) {
      if (inst instanceof AssignInst) {
        for (        Var dst : inst.dstLocalVar()) {
          if (!inst.liveOut().contains(dst))           blocks.get(index).delete(inst);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void eliminate(Function function){
  List<BasicBlock> blocks=function.basicBlocks();
  for (int index=blocks.size() - 1; index >= 0; --index) {
    for (Instruction inst=blocks.get(index).back(); inst != null; inst=inst.prev) {
      if (inst instanceof AssignInst) {
        for (        Var dst : inst.dstLocalVar()) {
          if (!inst.liveOut().contains(dst) && !(inst instanceof FunctionCallInst)) {
            blocks.get(index).delete(inst);
          }
        }
      }
    }
  }
}
Program: 78218
Project: 78218
Buggy source:
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  appendUsedVar(left,registers);
  appendUsedVar(right,registers);
  return registers;
}

Fixed version (ground truth):
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  appendUsedVar(left,registers);
  appendUsedVar(right,registers);
  if (dst() instanceof Memory)   appendUsedVar(dst(),registers);
  return registers;
}
Program: 78219
Project: 78219
Buggy source:
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  for (  Operand operand : args) {
    appendUsedVar(operand,registers);
  }
  return registers;
}

Fixed version (ground truth):
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  for (  Operand operand : args) {
    appendUsedVar(operand,registers);
  }
  if (dst() instanceof Memory)   appendUsedVar(dst(),registers);
  return registers;
}
Program: 78220
Project: 78220
Buggy source:
public Operand val(){
  return val;
}

Fixed version (ground truth):
public Operand val(){
  return src;
}
Program: 78221
Project: 78221
Buggy source:
@Override public AssignInst sameCopy(){
  return new MoveInst(dst(),val);
}

Fixed version (ground truth):
@Override public AssignInst sameCopy(){
  return new MoveInst(dst(),src);
}
Program: 78222
Project: 78222
Buggy source:
@Override public AssignInst processKnownReg(BasicBlock basicBlock){
  if (val instanceof Register) {
    Literal valLiteral=basicBlock.getKnownReg((Register)val);
    if (valLiteral != null)     val=valLiteral;
  }
  return this;
}

Fixed version (ground truth):
@Override public AssignInst processKnownReg(BasicBlock basicBlock){
  if (src instanceof Register) {
    Literal valLiteral=basicBlock.getKnownReg((Register)src);
    if (valLiteral != null)     src=valLiteral;
  }
  return this;
}
Program: 78223
Project: 78223
Buggy source:
public MoveInst(MutableOperand dst,Operand val){
  super(dst);
  this.val=val;
}

Fixed version (ground truth):
public MoveInst(MutableOperand dst,Operand src){
  super(dst);
  this.src=src;
}
Program: 78224
Project: 78224
Buggy source:
@Override public AssignInst copy(Map<Object,Object> replaceMap){
  return new MoveInst((MutableOperand)dst().dstCopy(replaceMap),val.copy(replaceMap));
}

Fixed version (ground truth):
@Override public AssignInst copy(Map<Object,Object> replaceMap){
  return new MoveInst((MutableOperand)dst().dstCopy(replaceMap),src.copy(replaceMap));
}
Program: 78225
Project: 78225
Buggy source:
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  appendUsedVar(val,registers);
  if (super.dst() instanceof Memory)   registers.addAll(((Memory)super.dst()).usedVar());
  return registers;
}

Fixed version (ground truth):
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  appendUsedVar(src,registers);
  if (super.dst() instanceof Memory)   appendUsedVar(dst(),registers);
  return registers;
}
Program: 78226
Project: 78226
Buggy source:
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  appendUsedVar(src,registers);
  return registers;
}

Fixed version (ground truth):
@Override public List<Var> usedVar(){
  LinkedList<Var> registers=new LinkedList<>();
  appendUsedVar(src,registers);
  if (dst() instanceof Memory)   appendUsedVar(dst(),registers);
  return registers;
}
Program: 78227
Project: 78227
Buggy source:
@Override public List<Var> usedVar(){
  List<Var> regs=new ArrayList<>();
  if (retVal instanceof Var)   regs.add((Var)retVal);
  return regs;
}

Fixed version (ground truth):
@Override public List<Var> usedVar(){
  List<Var> regs=new ArrayList<>();
  if (retVal instanceof Var)   regs.add((Var)retVal);
 else   if (retVal instanceof Memory)   regs.addAll(((Memory)retVal).usedVar());
  return regs;
}
Program: 78228
Project: 78228
Buggy source:
private Operand visitLogic(BinaryExprNode node){
  Function function=currentBasicBlock.getParentFunction();
  ExprOps op=node.getOp();
  Operand left=visit(node.getLeft());
  BasicBlock next=new BasicBlock(function,currentSymbolTable,"String_Node_Str");
switch (op) {
case AND:
    if (left instanceof IntLiteral) {
      if (((IntLiteral)left).getVal() == 0)       return left;
      return visit(node.getRight());
    }
  BasicBlock valTrue=new BasicBlock(function,new SymbolTable(currentSymbolTable),"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valTrue,next));
setCurrentEnv(valTrue);
break;
case OR:
if (left instanceof IntLiteral) {
if (((IntLiteral)left).getVal() == 1) return left;
return visit(node.getRight());
}
BasicBlock valFalse=new BasicBlock(function,new SymbolTable(currentSymbolTable),"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valFalse,next));
setCurrentEnv(valFalse);
break;
}
Operand right=visit(node.getRight());
currentBasicBlock.pushBack(new MoveInst((Var)left,right),valTag);
currentBasicBlock.pushBack(new DirectJumpInst(next));
setCurrentEnv(next);
return left;
}

Fixed version (ground truth):
private Operand visitLogic(BinaryExprNode node){
  Function function=currentBasicBlock.getParentFunction();
  ExprOps op=node.getOp();
  Operand left=visit(node.getLeft());
  BasicBlock next=new BasicBlock(function,currentSymbolTable,"String_Node_Str");
switch (op) {
case AND:
    if (left instanceof IntLiteral) {
      if (((IntLiteral)left).getVal() == 0)       return left;
      return visit(node.getRight());
    }
  BasicBlock valTrue=new BasicBlock(function,SymbolTable.builder(currentSymbolTable),"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,valTrue,next));
setCurrentEnv(valTrue);
break;
case OR:
if (left instanceof IntLiteral) {
if (((IntLiteral)left).getVal() == 1) return left;
return visit(node.getRight());
}
BasicBlock valFalse=new BasicBlock(function,SymbolTable.builder(currentSymbolTable),"String_Node_Str");
currentBasicBlock.pushBack(new CondJumpInst(left,next,valFalse));
setCurrentEnv(valFalse);
break;
}
Operand right=visit(node.getRight());
currentBasicBlock.pushBack(new MoveInst((Var)left,right),valTag);
currentBasicBlock.pushBack(new DirectJumpInst(next));
setCurrentEnv(next);
return left;
}
Program: 78229
Project: 78229
Buggy source:
private Operand visitArithComp(Operand left,ExprOps op,Operand right,TypeSymbol type){
  Operand leftVal=getVal(left);
  Operand rightVal=getVal(right);
  if (leftVal instanceof Literal && rightVal instanceof Literal) {
    return literalCalc(leftVal,op,rightVal);
  }
  Var dst=Var.builder(op.toString());
  if (type != NonArrayTypeSymbol.STRING_TYPE_SYMBOL) {
    return currentBasicBlock.pushBack(new BinaryExprInst(dst,leftVal,op,rightVal),valTag);
  }
  List<Operand> args=new ArrayList<>(Arrays.asList(leftVal,rightVal));
switch (op) {
case ADD:
    if (left.equals(EMPTY_STRING))     return right;
 else     if (right.equals(EMPTY_STRING))     return left;
  return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_ADD,args,dst),valTag);
case GT:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_GT,args,dst),valTag);
case LT:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_LT,args,dst),valTag);
case GTE:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_GTE,args,dst),valTag);
case LTE:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_LTE,args,dst),valTag);
case EQ:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_EQ,args,dst),valTag);
case NEQ:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_NEQ,args,dst),valTag);
default :
throw new RuntimeException("String_Node_Str");
}
}

Fixed version (ground truth):
private Operand visitArithComp(Operand left,ExprOps op,Operand right,TypeSymbol type){
  Operand leftVal=getVal(left);
  Operand rightVal=getVal(right);
  if (leftVal instanceof Literal && rightVal instanceof Literal) {
    return literalCalc(leftVal,op,rightVal);
  }
  Var dst=Var.tmpBuilder(op.toString());
  if (type != NonArrayTypeSymbol.STRING_TYPE_SYMBOL) {
    return currentBasicBlock.pushBack(new BinaryExprInst(dst,leftVal,op,rightVal),valTag);
  }
  List<Operand> args=new ArrayList<>(Arrays.asList(leftVal,rightVal));
switch (op) {
case ADD:
    if (left.equals(EMPTY_STRING))     return right;
 else     if (right.equals(EMPTY_STRING))     return left;
  return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_ADD,args,dst),valTag);
case GT:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_GT,args,dst),valTag);
case LT:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_LT,args,dst),valTag);
case GTE:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_GTE,args,dst),valTag);
case LTE:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_LTE,args,dst),valTag);
case EQ:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_EQ,args,dst),valTag);
case NEQ:
return currentBasicBlock.pushBack(new FunctionCallInst(Function.STR_NEQ,args,dst),valTag);
default :
throw new RuntimeException("String_Node_Str");
}
}
Program: 78230
Project: 78230
Buggy source:
private Operand getParamForMem(Operand x,String name){
  if (x instanceof Var || x instanceof Literal)   return x;
  Var tmp=Var.builder(name);
  currentBasicBlock.pushBack(new MoveInst(tmp,x),valTag);
  return tmp;
}

Fixed version (ground truth):
private Operand getParamForMem(Operand x,String name){
  if (x instanceof Var || x instanceof Literal)   return x;
  Var tmp=Var.tmpBuilder(name);
  currentBasicBlock.pushBack(new MoveInst(tmp,x),valTag);
  return tmp;
}
Program: 78231
Project: 78231
Buggy source:
private Operand visitCreateClass(NonArrayTypeSymbol classType){
  Var classReg=Var.builder("String_Node_Str" + classType.getName());
  IntLiteral sizeLiteral=new IntLiteral(classType.getSize());
  currentBasicBlock.pushBack(new FunctionCallInst(Function.MALLOC,new ArrayList<>(Collections.singleton(sizeLiteral)),classReg),valTag);
  SymbolInfo constructorSymbolInfo=SymbolTable.getClassSymbolTable(classType).findIn(Instance.CONSTRUCTOR);
  if (constructorSymbolInfo != null) {
    currentBasicBlock.pushBack(new FunctionCallInst(getFunction((FunctionSymbol)constructorSymbolInfo.getSymbol()),new ArrayList<>(Collections.singleton(classReg)),classReg),valTag);
  }
  return classReg;
}

Fixed version (ground truth):
private Operand visitCreateClass(NonArrayTypeSymbol classType){
  Var classReg=Var.tmpBuilder("String_Node_Str" + classType.getName());
  IntLiteral sizeLiteral=new IntLiteral(classType.getSize());
  currentBasicBlock.pushBack(new FunctionCallInst(Function.MALLOC,new ArrayList<>(Collections.singleton(sizeLiteral)),classReg),valTag);
  SymbolInfo constructorSymbolInfo=SymbolTable.getClassSymbolTable(classType).findIn(Instance.CONSTRUCTOR);
  if (constructorSymbolInfo != null) {
    currentBasicBlock.pushBack(new FunctionCallInst(getFunction((FunctionSymbol)constructorSymbolInfo.getSymbol()),new ArrayList<>(Collections.singleton(classReg)),classReg),valTag);
  }
  return classReg;
}
Program: 78233
Project: 78233
Buggy source:
private void getCurrentSymbolTable(BlockNode node){
  if (node.getCurrentSymbolTable() == null) {
    node.setCurrentSymbolTable(new SymbolTable(currentSymbolTable));
  }
  currentSymbolTable=node.getCurrentSymbolTable();
}

Fixed version (ground truth):
private void getCurrentSymbolTable(BlockNode node){
  if (node.getCurrentSymbolTable() == null) {
    node.setCurrentSymbolTable(SymbolTable.builder(currentSymbolTable));
  }
  currentSymbolTable=node.getCurrentSymbolTable();
}
Program: 78234
Project: 78234
Buggy source:
public Var(Instance symbol,SymbolTable symbolTable){
  this.name=symbol.getName();
  this.symbolTable=symbolTable;
}

Fixed version (ground truth):
private Var(Instance symbol,SymbolTable symbolTable){
  this.name=symbol.getName();
  this.symbolTable=symbolTable;
}
Program: 78235
Project: 78235
Buggy source:
public static Var builder(String preName){
  String name=preName + "String_Node_Str";
  Var search=identifierMap.get(name);
  if (search == null)   search=new Var(name,0);
 else   search=new Var(name,search.id + 1);
  identifierMap.put(name,search);
  return search;
}

Fixed version (ground truth):
public static Var builder(Instance symbol,SymbolTable symbolTable){
  Var var=new Var(symbol,symbolTable);
  symbolTable.addVar(var);
  return var;
}
Program: 78236
Project: 78236
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + name + "String_Node_Str"+ ((symbolTable != null) ? symbolTable.hashCode() : id);
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + name + "String_Node_Str"+ (isTmp() ? id : symbolTable.hashCode());
}
Program: 78237
Project: 78237
Buggy source:
public SymbolTable(SymbolTable outerSymbolTable){
  this.outerSymbolTable=outerSymbolTable;
}

Fixed version (ground truth):
private SymbolTable(SymbolTable outerSymbolTable){
  this.outerSymbolTable=outerSymbolTable;
}
Program: 78238
Project: 78238
Buggy source:
private Memory visitMemory(Memory memory,PhysicalRegister reg1,PhysicalRegister reg2){
  Register baseReg=memory.baseReg();
  Register indexReg=memory.indexReg();
  Var baseVar=(Var)baseReg;
  append("String_Node_Str",reg1,baseVar);
  baseReg=reg1;
  if (indexReg != null) {
    Var indexVar=(Var)indexReg;
    append("String_Node_Str",reg2,indexVar);
    indexReg=reg2;
  }
  return new Memory(baseReg,indexReg,memory.scale(),memory.disp());
}

Fixed version (ground truth):
private Operand visitMemory(Operand operand,PhysicalRegister reg1,PhysicalRegister reg2){
  if (!(operand instanceof Memory))   return operand;
  Memory memory=(Memory)operand;
  Register baseReg=memory.baseReg();
  Register indexReg=memory.indexReg();
  Var baseVar=(Var)baseReg;
  if (isMem(baseVar)) {
    append("String_Node_Str",reg1,baseVar);
    baseReg=reg1;
  }
 else   baseReg=baseVar.physicalRegister();
  if (indexReg != null) {
    Var indexVar=(Var)indexReg;
    if (isMem(indexVar)) {
      append("String_Node_Str",reg2,indexVar);
      indexReg=reg2;
    }
 else     indexReg=indexVar.physicalRegister();
  }
  return new Memory(baseReg,indexReg,memory.scale(),memory.disp());
}
Program: 78239
Project: 78239
Buggy source:
private Pair<Operand,Operand> varToReg(Operand left,Operand right,boolean rightTmp){
  if (isMem(left) && isMem(right)) {
    if (left instanceof Memory)     left=visitMemory((Memory)left,RAX,RSI);
    if (!rightTmp) {
      append("String_Node_Str",RSI,left);
      if (left == right)       right=RSI;
      left=RSI;
    }
    if (right instanceof Memory)     right=visitMemory((Memory)right,RAX,RDI);
    if (rightTmp) {
      append("String_Node_Str",RDI,right);
      if (left == right)       left=RDI;
      right=RDI;
    }
  }
 else {
    if (left instanceof Memory)     left=visitMemory((Memory)left,RAX,RSI);
    if (right instanceof Memory)     right=visitMemory((Memory)right,RAX,RSI);
  }
  return new Pair<>(left,right);
}

Fixed version (ground truth):
private Pair<Operand,Operand> varToReg(Operand left,Operand right,boolean rightTmp){
  if (isMem(left) && isMem(right)) {
    left=visitMemory(left,RAX,RSI);
    if (!rightTmp) {
      append("String_Node_Str",RSI,left);
      if (left == right)       right=RSI;
      left=RSI;
    }
    right=visitMemory(right,RAX,RDI);
    if (rightTmp) {
      append("String_Node_Str",RDI,right);
      if (left == right)       left=RDI;
      right=RDI;
    }
  }
 else {
    left=visitMemory(left,RAX,RSI);
    right=visitMemory(right,RAX,RSI);
  }
  return new Pair<>(left,right);
}
Program: 78240
Project: 78240
Buggy source:
public void apply(ProgramIR programIR){
  assembly=new StringBuilder();
  programIR.getFunctionMap().values().forEach(func -> {
    if (func.isUserFunc())     append("String_Node_Str",func.name());
  }
);
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  indent="String_Node_Str";
  programIR.getFunctionMap().values().forEach(this::visit);
  assembly.append("String_Node_Str");
  for (  StringLiteral s : programIR.getStringPool().values()) {
    assembly.append(s.getLabel()).append("String_Node_Str").append("String_Node_Str").append(s.getVal()).append("String_Node_Str");
  }
  options.out.print(assembly.toString());
}

Fixed version (ground truth):
public void apply(ProgramIR programIR){
  assembly=new StringBuilder();
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  indent="String_Node_Str";
  programIR.getFunctionMap().values().forEach(this::visit);
  assembly.append("String_Node_Str");
  for (  StringLiteral s : programIR.getStringPool().values()) {
    assembly.append(s.getLabel()).append("String_Node_Str").append("String_Node_Str").append(s.getVal()).append("String_Node_Str");
  }
  for (  Map.Entry<Var,IntLiteral> entry : programIR.getGlobalPool().entrySet()) {
    IntLiteral val=entry.getValue();
    if (val != null)     assembly.append(entry.getKey().nasmName()).append("String_Node_Str").append("String_Node_Str").append(val.getVal()).append("String_Node_Str");
  }
  assembly.append("String_Node_Str");
  for (  Map.Entry<Var,IntLiteral> entry : programIR.getGlobalPool().entrySet()) {
    IntLiteral val=entry.getValue();
    if (val == null)     assembly.append(entry.getKey().nasmName()).append("String_Node_Str").append("String_Node_Str").append(1).append("String_Node_Str");
  }
  options.out.print(assembly.toString());
}
Program: 78241
Project: 78241
Buggy source:
private String visitCmp(Operand left,Operand right,ExprOps op){
  if (left instanceof IntLiteral) {
    Operand tmp=left;
    left=right;
    right=tmp;
    op=op.revert();
  }
  append("String_Node_Str",varToReg(left,right));
  return op.nasmOp();
}

Fixed version (ground truth):
private String visitCmp(Operand left,Operand right,ExprOps op){
  if (left instanceof IntLiteral) {
    op=op.exchange();
    Operand tmp=left;
    left=right;
    right=tmp;
  }
  append("String_Node_Str",varToReg(left,right));
  return op.nasmOp();
}
Program: 78242
Project: 78242
Buggy source:
private void append(String s){
  assembly.append(indent).append(s).append("String_Node_Str");
}

Fixed version (ground truth):
private void append(String s){
  preMovOp=null;
  assembly.append(indent).append(s).append("String_Node_Str");
}
Program: 78243
Project: 78243
Buggy source:
public void clearStatement(Integer i){
  statements=statements.subList(0,i);
}

Fixed version (ground truth):
public void clearStatement(int i){
  statements=statements.subList(0,i);
}
Program: 78244
Project: 78244
Buggy source:
public TypeNode(String type,Integer dim,Location pos){
  if (dim == 0) {
    this.typeSymbol=NonArrayTypeSymbol.builder(type);
  }
 else {
    this.typeSymbol=ArrayTypeSymbol.builder(type,dim);
  }
  this.location=pos;
}

Fixed version (ground truth):
public TypeNode(String type,int dim,Location pos){
  if (dim == 0) {
    this.typeSymbol=NonArrayTypeSymbol.builder(type);
  }
 else {
    this.typeSymbol=ArrayTypeSymbol.builder(type,dim);
  }
  this.location=pos;
}
Program: 78245
Project: 78245
Buggy source:
public Integer getEmptyDim(){
  return emptyDim;
}

Fixed version (ground truth):
public int getEmptyDim(){
  return emptyDim;
}
Program: 78246
Project: 78246
Buggy source:
public NewExprNode(String createType,Integer dim,List<ExprNode> dimArgs,Location pos){
  super(pos);
  if (dim == 0) {
    this.createType=NonArrayTypeSymbol.builder(createType);
  }
 else {
    this.createType=ArrayTypeSymbol.builder(createType,dim);
    this.emptyDim=dim - dimArgs.size();
  }
  this.dimArgs=dimArgs;
}

Fixed version (ground truth):
public NewExprNode(String createType,int dim,List<ExprNode> dimArgs,Location pos){
  super(pos);
  if (dim == 0) {
    this.createType=NonArrayTypeSymbol.builder(createType);
  }
 else {
    this.createType=ArrayTypeSymbol.builder(createType,dim);
    this.emptyDim=dim - dimArgs.size();
  }
  this.dimArgs=dimArgs;
}
Program: 78247
Project: 78247
Buggy source:
public Boolean getVal(){
  return val;
}

Fixed version (ground truth):
public boolean getVal(){
  return val;
}
Program: 78248
Project: 78248
Buggy source:
public Integer getVal(){
  return val;
}

Fixed version (ground truth):
public int getVal(){
  return val;
}
Program: 78249
Project: 78249
Buggy source:
public NaiveAllocator(CompilerOptions options){
  this.options=options;
}

Fixed version (ground truth):
public NaiveAllocator(CompilerOptions options){
  this.options=options;
  PARAM_START_SIZE=2 * options.PTR_SIZE;
}
Program: 78250
Project: 78250
Buggy source:
public void compileFunction(Function function){
}

Fixed version (ground truth):
private void compileFunction(Function function){
  int paramStackTop=PARAM_START_SIZE;
  for (  Var param : function.getParamVReg()) {
    param.setStackPos(new Memory(RBP,null,0,-paramStackTop));
    paramStackTop+=options.PTR_SIZE;
  }
  int localVarStackTop=paramStackTop;
  localVarStackTop=locateLocalVariables(function.getSymbolTable(),localVarStackTop);
  int tmpVarStackTop=localVarStackTop;
  for (  Var var : function.getTmpVars()) {
    if (var.isTmp()) {
      var.setStackPos(new Memory(RBP,null,0,tmpVarStackTop));
      tmpVarStackTop+=options.PTR_SIZE;
    }
  }
}
Program: 78251
Project: 78251
Buggy source:
@Override public Node visitCreator(MxParser.CreatorContext ctx){
  String createType=ctx.createdName().getText();
  Integer dim=0;
  List<ExprNode> dimArgs=new ArrayList<>();
  if (ctx.arrayCreatorRest() != null) {
    List<MxParser.CreatorInnerContext> creatorInnerContext=ctx.arrayCreatorRest().creatorInner();
    dim=creatorInnerContext.size();
    for (Integer index=0; index < dim; ++index) {
      MxParser.ExprContext exprContext=creatorInnerContext.get(index).expr();
      if (exprContext != null) {
        if (index != dimArgs.size()) {
          throw new CompileError(stage,"String_Node_Str" + "String_Node_Str",new Location(creatorInnerContext.get(index)));
        }
        dimArgs.add((ExprNode)visit(exprContext));
      }
    }
  }
  return new NewExprNode(createType,dim,dimArgs,new Location(ctx));
}

Fixed version (ground truth):
@Override public Node visitCreator(MxParser.CreatorContext ctx){
  String createType=ctx.createdName().getText();
  int dim=0;
  List<ExprNode> dimArgs=new ArrayList<>();
  if (ctx.arrayCreatorRest() != null) {
    List<MxParser.CreatorInnerContext> creatorInnerContext=ctx.arrayCreatorRest().creatorInner();
    dim=creatorInnerContext.size();
    for (int index=0; index < dim; ++index) {
      MxParser.ExprContext exprContext=creatorInnerContext.get(index).expr();
      if (exprContext != null) {
        if (index != dimArgs.size()) {
          throw new CompileError(stage,"String_Node_Str" + "String_Node_Str",new Location(creatorInnerContext.get(index)));
        }
        dimArgs.add((ExprNode)visit(exprContext));
      }
    }
  }
  return new NewExprNode(createType,dim,dimArgs,new Location(ctx));
}
Program: 78252
Project: 78252
Buggy source:
public void compile(String[] args){
  options.compilerArgSolve(args);
  buildAst();
  typeCheck();
  if (options.dumpAst) {
    DumpAstVisitor astDumper=new DumpAstVisitor(options);
    astDumper.apply(programAst);
  }
  buildIR();
  if (options.functionInline)   functionInliner();
  if (options.dumpIR) {
    DumpIRVisitor irDumper=new DumpIRVisitor(options);
    irDumper.apply(programIR);
  }
  livenessAnalysis();
  allocate();
  codeGenerate();
}

Fixed version (ground truth):
public void compile(String[] args){
  options.compilerArgSolve(args);
  buildAst();
  typeCheck();
  if (options.dumpAst)   dumpAst();
  buildIR();
  if (options.functionInline)   functionInliner();
  livenessAnalysis();
  if (options.dumpIR)   dumpIR();
  allocate();
  codeGenerate();
}
Program: 78253
Project: 78253
Buggy source:
private void assignRegister(){
  Set<PhysicalRegister> neighborReg=new HashSet<>();
  while (!graph.varStack.isEmpty()) {
    neighborReg.clear();
    Var var=graph.varStack.pop();
    var.deleted=false;
    for (    Var neighbor : var.neighbors())     if (!neighbor.deleted && neighbor.assignedReg())     neighborReg.add(neighbor.physicalRegister());
    for (    PhysicalRegister preg : registers) {
      if (!neighborReg.contains(preg)) {
        var.setPhysicalRegister(preg);
        usedRegs.add(preg);
        break;
      }
    }
    if (!var.assignedReg()) {
      stackTop=alignStack(stackTop + options.PTR_SIZE,options.PTR_SIZE);
      var.setStackPos(new Memory(RBP,null,0,-stackTop));
    }
  }
}

Fixed version (ground truth):
private void assignRegister(){
  Set<PhysicalRegister> neighborReg=new HashSet<>();
  while (!graph.varStack.isEmpty()) {
    neighborReg.clear();
    Var var=graph.varStack.pop();
    var.deleted=false;
    for (    Var neighbor : var.neighbors())     if (!neighbor.deleted && neighbor.isAssigned())     neighborReg.add(neighbor.physicalRegister());
    for (    PhysicalRegister preg : registers) {
      if (!neighborReg.contains(preg)) {
        var.setPhysicalRegister(preg);
        usedRegs.add(preg);
        break;
      }
    }
    if (!var.isAssigned()) {
      stackTop=alignStack(stackTop + options.PTR_SIZE,options.PTR_SIZE);
      var.setStackPos(new Memory(RBP,null,0,-stackTop));
    }
  }
}
Program: 78254
Project: 78254
Buggy source:
public List<Var> usedVar(){
  List<Var> registers=new ArrayList<>();
  if (baseReg instanceof Var)   registers.add((Var)baseReg);
  if (indexReg instanceof Var)   registers.add((Var)baseReg);
  return registers;
}

Fixed version (ground truth):
public List<Var> usedVar(){
  List<Var> registers=new ArrayList<>();
  if (baseReg instanceof Var)   registers.add((Var)baseReg);
  if (indexReg instanceof Var)   registers.add((Var)indexReg);
  return registers;
}
Program: 78255
Project: 78255
Buggy source:
private void visitPrintCall(List<Operand> args,boolean newline){
  Instruction lastInst=currentBasicBlock.back();
  StringLiteral formatStr=newline ? StringLiteral.stringlnFormat : StringLiteral.stringFormat;
  Operand outputReg;
  if (lastInst instanceof FunctionCallInst) {
    FunctionCallInst lastFunctionCall=(FunctionCallInst)lastInst;
    if (lastFunctionCall.function() == Function.TO_STRING && lastFunctionCall.dst() == args.get(0)) {
      currentBasicBlock.popBack();
      outputReg=lastFunctionCall.args().get(0);
      formatStr=newline ? StringLiteral.intlnFormat : StringLiteral.intFormat;
    }
 else     outputReg=args.get(0);
  }
 else {
    outputReg=args.get(0);
  }
  List<Operand> printArgs=new ArrayList<>();
  printArgs.add(formatStr);
  printArgs.add(outputReg);
  currentBasicBlock.pushBack(new FunctionCallInst(Function.PRINT_INT,printArgs,null),valTag);
}

Fixed version (ground truth):
private void visitPrintCall(List<Operand> args,boolean newline){
  Instruction lastInst=currentBasicBlock.back();
  StringLiteral formatStr=newline ? StringLiteral.stringlnFormat : StringLiteral.stringFormat;
  Operand outputReg;
  if (lastInst instanceof FunctionCallInst) {
    FunctionCallInst lastFunctionCall=(FunctionCallInst)lastInst;
    if (lastFunctionCall.function() == Function.TO_STRING && lastFunctionCall.dst() == args.get(0)) {
      currentBasicBlock.popBack();
      outputReg=lastFunctionCall.args().get(0);
      formatStr=newline ? StringLiteral.intlnFormat : StringLiteral.intFormat;
    }
 else     outputReg=args.get(0);
  }
 else   outputReg=args.get(0);
  List<Operand> printArgs=new ArrayList<>();
  printArgs.add(formatStr);
  printArgs.add(outputReg);
  currentBasicBlock.pushBack(new FunctionCallInst(Function.PRINT_INT,printArgs,null),valTag);
}
Program: 78256
Project: 78256
Buggy source:
public void cleanUp(){
  Map<BasicBlock,BasicBlock> jumpLabelChangeMap=new HashMap<>();
  LinkedList<BasicBlock> newBlocks=new LinkedList<>();
  int size=basicBlocks.size();
  for (int i=size - 1; i >= 0; --i) {
    BasicBlock block=basicBlocks.get(i);
    if (block.front() == block.back() && block.back() instanceof DirectJumpInst) {
      DirectJumpInst directJumpInst=(DirectJumpInst)block.back();
      jumpLabelChangeMap.put(block,directJumpInst.target());
    }
  }
  for (int i=size - 1; i >= 0; --i) {
    BasicBlock block=basicBlocks.get(i);
    if (block.back() instanceof DirectJumpInst) {
      DirectJumpInst directJumpInst=(DirectJumpInst)block.back();
      directJumpInst.setTarget(searchForNewTarget(jumpLabelChangeMap,directJumpInst.target()));
    }
 else     if (block.back() instanceof CondJumpInst) {
      CondJumpInst condJumpInst=(CondJumpInst)block.back();
      condJumpInst.setIfTrue(searchForNewTarget(jumpLabelChangeMap,condJumpInst.ifTrue()));
      condJumpInst.setIfFalse(searchForNewTarget(jumpLabelChangeMap,condJumpInst.ifFalse()));
      if (condJumpInst.ifTrue() == newBlocks.getFirst())       condJumpInst.not();
    }
    if (block.front() != block.back() || !(block.back() instanceof DirectJumpInst))     newBlocks.addFirst(block);
  }
  basicBlocks=newBlocks;
}

Fixed version (ground truth):
public void cleanUp(){
  Map<BasicBlock,BasicBlock> jumpLabelChangeMap=new HashMap<>();
  LinkedList<BasicBlock> newBlocks=new LinkedList<>();
  int size=basicBlocks.size();
  for (int i=size - 1; i >= 0; --i) {
    BasicBlock block=basicBlocks.get(i);
    if (block.front() == block.back() && block.back() instanceof DirectJumpInst) {
      DirectJumpInst directJumpInst=(DirectJumpInst)block.back();
      jumpLabelChangeMap.put(block,directJumpInst.target());
    }
 else     if (block.front() == null)     jumpLabelChangeMap.put(block,basicBlocks.get(i + 1));
  }
  for (int i=size - 1; i >= 0; --i) {
    BasicBlock block=basicBlocks.get(i);
    if (block.back() instanceof DirectJumpInst) {
      DirectJumpInst directJumpInst=(DirectJumpInst)block.back();
      directJumpInst.setTarget(searchForNewTarget(jumpLabelChangeMap,directJumpInst.target()));
    }
 else     if (block.back() instanceof CondJumpInst) {
      CondJumpInst condJumpInst=(CondJumpInst)block.back();
      condJumpInst.setIfTrue(searchForNewTarget(jumpLabelChangeMap,condJumpInst.ifTrue()));
      condJumpInst.setIfFalse(searchForNewTarget(jumpLabelChangeMap,condJumpInst.ifFalse()));
      if (condJumpInst.ifTrue() == newBlocks.getFirst())       condJumpInst.not();
      if (condJumpInst.ifTrue() == condJumpInst.ifFalse()) {
        block.popBack();
        block.pushBack(new DirectJumpInst(condJumpInst.ifTrue()));
      }
    }
    if (block.front() != null && (block.front() != block.back() || !(block.back() instanceof DirectJumpInst)))     newBlocks.addFirst(block);
  }
  basicBlocks=newBlocks;
}
Program: 78257
Project: 78257
Buggy source:
private Pair<Operand,Operand> varToReg(Operand left,Operand right,boolean rightTmp){
  if (isMem(left) && isMem(right)) {
    left=visitMemory(left,RAX,RSI);
    if (!rightTmp) {
      append("String_Node_Str",RSI,left);
      if (left == right)       right=RSI;
      left=RSI;
    }
    right=visitMemory(right,RAX,RDI);
    if (rightTmp) {
      append("String_Node_Str",RDI,right);
      if (left == right)       left=RDI;
      right=RDI;
    }
  }
 else {
    left=visitMemory(left,RAX,RSI);
    right=visitMemory(right,RAX,RSI);
  }
  return new Pair<>(left,right);
}

Fixed version (ground truth):
private Pair<Operand,Operand> varToReg(Operand left,Operand right,boolean rightTmp){
  if (isMem(left) && isMem(right)) {
    left=visitMemory(left,RCX,RSI);
    if (!rightTmp) {
      append("String_Node_Str",RSI,left);
      if (left == right)       right=RSI;
      left=RSI;
    }
    right=visitMemory(right,RCX,RDI);
    if (rightTmp) {
      append("String_Node_Str",RDI,right);
      if (left == right)       left=RDI;
      right=RDI;
    }
  }
 else {
    left=visitMemory(left,RCX,RSI);
    right=visitMemory(right,RCX,RSI);
  }
  return new Pair<>(left,right);
}
Program: 78258
Project: 78258
Buggy source:
@Override public Void visit(FunctionDeclNode node){
  if (currentSymbolTable.findIn(node.getInstance()) != null) {
    throw new CompileError(stage,"String_Node_Str" + StringProcess.getRefString(node.getInstance().getName()) + "String_Node_Str",node.location());
  }
  if (node.getInstance().getName().equals("String_Node_Str"))   mainLocation=node.location();
  currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  if (inClass)   currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  node.getFunctionSymbol().addNamePrefix(funcPrefix);
  return null;
}

Fixed version (ground truth):
@Override public Void visit(FunctionDeclNode node){
  if (currentSymbolTable.findIn(node.getInstance()) != null) {
    throw new CompileError(stage,"String_Node_Str" + StringProcess.getRefString(node.getInstance().getName()) + "String_Node_Str",node.location());
  }
  if (node.getInstance().getName().equals("String_Node_Str"))   mainLocation=node.location();
  currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  if (inClass) {
    currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
    node.getFunctionSymbol().setClassSymbolTable(currentSymbolTable);
  }
  node.getFunctionSymbol().addNamePrefix(funcPrefix);
  return null;
}
Program: 78259
Project: 78259
Buggy source:
private void visitGlobalClassVariable(BlockNode node){
  SymbolTable prevSymbolTable=currentSymbolTable;
  currentSymbolTable=node.getCurrentSymbolTable();
  for (  Node decl : node.getStatements()) {
    if (decl instanceof ClassDeclNode) {
      getClassMemberVariableOffset((ClassDeclNode)decl,options.PTR_SIZE);
    }
  }
  for (  Node decl : node.getStatements()) {
    if (decl instanceof ClassDeclNode) {
      ClassDeclNode classNode=(ClassDeclNode)decl;
      BlockNode block=classNode.getBody();
      classDeclSymbol=classNode.getClassSymbol();
      inClassFunc=true;
      visitFunction(block);
      inClassFunc=false;
      classDeclSymbol=null;
    }
 else     if (decl instanceof VariableDeclNode) {
      setCurrentEnv(globalInitBlocks.getLast());
      isGlobal=true;
      visit(decl);
      isGlobal=false;
    }
  }
  currentSymbolTable=prevSymbolTable;
}

Fixed version (ground truth):
private void visitGlobalClassVariable(BlockNode node){
  SymbolTable prevSymbolTable=currentSymbolTable;
  currentSymbolTable=node.getCurrentSymbolTable();
  for (  Node decl : node.getStatements()) {
    if (decl instanceof ClassDeclNode) {
      getClassMemberVariableOffset((ClassDeclNode)decl,options.PTR_SIZE);
    }
  }
  for (  Node decl : node.getStatements()) {
    if (decl instanceof ClassDeclNode) {
      ClassDeclNode classNode=(ClassDeclNode)decl;
      BlockNode block=classNode.getBody();
      classDeclSymbol=classNode.getClassSymbol();
      inClassFunc=true;
      visitFunction(block);
      inClassFunc=false;
      classDeclSymbol=null;
      classDeclThisReg=null;
    }
 else     if (decl instanceof VariableDeclNode) {
      setCurrentEnv(globalInitBlocks.getLast());
      isGlobal=true;
      visit(decl);
      isGlobal=false;
    }
  }
  currentSymbolTable=prevSymbolTable;
}
Program: 78260
Project: 78260
Buggy source:
private void assignRegister(){
  Set<PhysicalRegister> neighborReg=new HashSet<>();
  while (!graph.varStack.isEmpty()) {
    neighborReg.clear();
    Var var=graph.varStack.pop();
    var.deleted=false;
    for (    Var neighbor : var.neighbors())     if (!neighbor.deleted && neighbor.isAssigned())     neighborReg.add(neighbor.physicalRegister());
    for (    PhysicalRegister preg : registers) {
      if (!neighborReg.contains(preg)) {
        var.setPhysicalRegister(preg);
        usedRegs.add(preg);
        break;
      }
    }
    if (!var.isAssigned()) {
      stackTop=alignStack(stackTop + options.PTR_SIZE,options.PTR_SIZE);
      var.setStackPos(new Memory(RBP,null,0,-stackTop));
    }
  }
}

Fixed version (ground truth):
private void assignRegister(){
  Set<PhysicalRegister> neighborReg=new HashSet<>();
  while (!graph.varStack.isEmpty()) {
    neighborReg.clear();
    Var var=graph.varStack.pop();
    var.deleted=false;
    for (    Var neighbor : var.neighbors())     if (!neighbor.deleted && neighbor.isAssigned())     neighborReg.add(neighbor.physicalRegister());
    for (    PhysicalRegister preg : registers) {
      if (!neighborReg.contains(preg)) {
        var.setPhysicalRegister(preg);
        usedRegs.add(preg);
        System.err.println("String_Node_Str" + var.irName() + "String_Node_Str"+ preg.nasmName());
        break;
      }
    }
    if (!var.isAssigned()) {
      stackTop=alignStack(stackTop + options.PTR_SIZE,options.PTR_SIZE);
      var.setStackPos(new Memory(RBP,null,0,-stackTop));
    }
  }
}
Program: 78261
Project: 78261
Buggy source:
@Override public Node visitLiteral(MxParser.LiteralContext ctx){
  String val=ctx.getText();
  LiteralExprNode node;
  Location literalPos=new Location(ctx);
switch (ctx.literalType.getType()) {
case MxParser.BoolLiteral:
    node=new BoolLiteralNode(val,literalPos);
  break;
case MxParser.IntLiteral:
node=new IntLiteralNode(val,literalPos);
break;
case MxParser.StringLiteral:
node=new StringLiteralNode(val,literalPos);
break;
case MxParser.NULL:
node=new NullLiteralNode(literalPos);
break;
default :
throw new CompileError(stage,"String_Node_Str",literalPos);
}
return node;
}

Fixed version (ground truth):
@Override public Node visitLiteral(MxParser.LiteralContext ctx){
  String val=ctx.getText();
  LiteralExprNode node;
  Location literalPos=new Location(ctx);
switch (ctx.literalType.getType()) {
case MxParser.BoolLiteral:
    node=new BoolLiteralNode(val,literalPos);
  break;
case MxParser.IntLiteral:
node=new IntLiteralNode(val,literalPos);
break;
case MxParser.StringLiteral:
val=val.replaceFirst("String_Node_Str","String_Node_Str");
val=val.replaceFirst("String_Node_Str","String_Node_Str");
node=new StringLiteralNode(val,literalPos);
break;
case MxParser.NULL:
node=new NullLiteralNode(literalPos);
break;
default :
throw new CompileError(stage,"String_Node_Str",literalPos);
}
return node;
}
Program: 78262
Project: 78262
Buggy source:
public StringLiteral(String val){
  label=NameBuilder.builder("String_Node_Str");
  val=val.replaceFirst("String_Node_Str","String_Node_Str");
  val=val.replaceFirst("String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  this.val=val;
}

Fixed version (ground truth):
public StringLiteral(String val){
  label=NameBuilder.builder("String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  this.val=val;
}
Program: 78263
Project: 78263
Buggy source:
public StringLiteral(String val){
  label=NameBuilder.builder("String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  this.val=val;
}

Fixed version (ground truth):
public StringLiteral(String val){
  label=NameBuilder.builder("String_Node_Str");
  this.val=val;
}
Program: 78264
Project: 78264
Buggy source:
public String hexVal(){
  StringJoiner str=new StringJoiner("String_Node_Str");
  for (  byte b : val.getBytes()) {
    str.add(String.format("String_Node_Str",b) + "String_Node_Str");
  }
  str.add("String_Node_Str");
  return str.toString();
}

Fixed version (ground truth):
public String hexVal(){
  String val=this.val;
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  val=val.replaceAll("String_Node_Str" + "String_Node_Str","String_Node_Str");
  StringJoiner str=new StringJoiner("String_Node_Str");
  for (  byte b : val.getBytes()) {
    str.add(String.format("String_Node_Str",b) + "String_Node_Str");
  }
  str.add("String_Node_Str");
  return str.toString();
}
Program: 78265
Project: 78265
Buggy source:
public void apply(ProgramIR programIR){
  assembly=new StringBuilder();
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  indent="String_Node_Str";
  programIR.getFunctionMap().values().forEach(this::visit);
  assembly.append("String_Node_Str");
  for (  StringLiteral s : programIR.getStringPool().values()) {
    assembly.append(s.getLabel()).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(s.getVal()).append("String_Node_Str").append("String_Node_Str");
  }
  for (  Map.Entry<Var,IntLiteral> entry : programIR.getGlobalPool().entrySet()) {
    IntLiteral val=entry.getValue();
    if (val != null)     assembly.append(entry.getKey().nasmName()).append("String_Node_Str").append("String_Node_Str").append(val.getVal()).append("String_Node_Str");
  }
  assembly.append("String_Node_Str");
  for (  Map.Entry<Var,IntLiteral> entry : programIR.getGlobalPool().entrySet()) {
    IntLiteral val=entry.getValue();
    if (val == null)     assembly.append(entry.getKey().nasmName()).append("String_Node_Str").append("String_Node_Str").append(1).append("String_Node_Str");
  }
  options.out.print(assembly.toString());
}

Fixed version (ground truth):
public void apply(ProgramIR programIR){
  assembly=new StringBuilder();
  if (options.nasmLibIncludeCMD)   assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  assembly.append("String_Node_Str");
  indent="String_Node_Str";
  programIR.getFunctionMap().values().forEach(this::visit);
  assembly.append("String_Node_Str");
  for (  StringLiteral s : programIR.getStringPool().values()) {
    assembly.append(s.getLabel()).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(s.getVal()).append("String_Node_Str").append("String_Node_Str");
  }
  for (  Map.Entry<Var,IntLiteral> entry : programIR.getGlobalPool().entrySet()) {
    IntLiteral val=entry.getValue();
    if (val != null)     assembly.append(entry.getKey().nasmName()).append("String_Node_Str").append("String_Node_Str").append(val.getVal()).append("String_Node_Str");
  }
  assembly.append("String_Node_Str");
  for (  Map.Entry<Var,IntLiteral> entry : programIR.getGlobalPool().entrySet()) {
    IntLiteral val=entry.getValue();
    if (val == null)     assembly.append(entry.getKey().nasmName()).append("String_Node_Str").append("String_Node_Str").append(1).append("String_Node_Str");
  }
  options.out.print(assembly.toString());
}
Program: 78267
Project: 78267
Buggy source:
@Override public Node visitProgram(MxParser.ProgramContext ctx){
  List<Node> declarators=new ArrayList<>();
  Location programPos=new Location(ctx);
  buildClassSymbol(ctx);
  for (  ParseTree child : ctx.declarator()) {
    Node childNode=visit(child);
    if (childNode instanceof DeclarationNode) {
      declarators.add(childNode);
      if (childNode instanceof VariableDeclNode) {
        VariableDeclNode variableDeclNode=(VariableDeclNode)childNode;
        TypeSymbol search=TypeSymbol.searchSymbol(variableDeclNode.getVarSymbol().getName());
        if (search != null) {
          throw new CompileError(stage,"String_Node_Str" + StringProcess.GREEN + variableDeclNode.getVarSymbol().getName()+ "String_Node_Str"+ "String_Node_Str",variableDeclNode.getStartLocation());
        }
      }
    }
 else     throw new CompileError(stage,"String_Node_Str",programPos);
  }
  BlockNode block=new BlockNode(declarators,programPos);
  return new ProgramNode(block,programPos);
}

Fixed version (ground truth):
@Override public Node visitProgram(MxParser.ProgramContext ctx){
  List<Node> declarators=new ArrayList<>();
  Location programPos=new Location(ctx);
  buildClassSymbol(ctx);
  for (  ParseTree child : ctx.declarator()) {
    Node childNode=visit(child);
    if (childNode instanceof DeclarationNode) {
      declarators.add(childNode);
      if (childNode instanceof VariableDeclNode) {
        VariableDeclNode variableDeclNode=(VariableDeclNode)childNode;
        TypeSymbol search=TypeSymbol.searchSymbol(variableDeclNode.getVarSymbol().getName());
        if (search != null) {
          throw new CompileError(stage,"String_Node_Str" + StringProcess.GREEN + variableDeclNode.getVarSymbol().getName()+ "String_Node_Str"+ "String_Node_Str",variableDeclNode.location());
        }
      }
    }
 else     throw new CompileError(stage,"String_Node_Str",programPos);
  }
  BlockNode block=new BlockNode(declarators,programPos);
  return new ProgramNode(block,programPos);
}
Program: 78268
Project: 78268
Buggy source:
@Override public Void visit(FunctionDeclNode node){
  if (currentSymbolTable.findIn(node.getInstance()) != null) {
    throw new CompileError(stage,"String_Node_Str" + StringProcess.getRefString(node.getInstance().getName()) + "String_Node_Str",node.getStartLocation());
  }
  if (node.getInstance().getName().equals("String_Node_Str"))   mainLocation=node.getStartLocation();
  currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  if (inClass)   currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  node.getFunctionSymbol().addNamePrefix(funcPrefix);
  return null;
}

Fixed version (ground truth):
@Override public Void visit(FunctionDeclNode node){
  if (currentSymbolTable.findIn(node.getInstance()) != null) {
    throw new CompileError(stage,"String_Node_Str" + StringProcess.getRefString(node.getInstance().getName()) + "String_Node_Str",node.location());
  }
  if (node.getInstance().getName().equals("String_Node_Str"))   mainLocation=node.location();
  currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  if (inClass)   currentSymbolTable.put(node.getInstance(),node.getFunctionSymbol());
  node.getFunctionSymbol().addNamePrefix(funcPrefix);
  return null;
}