Program: 78232
Project: 78232
Buggy source:
private Operand visitCreateArray(NewExprNode node,Integer index){
  Var baseReg=Var.builder("String_Node_Str");
  Operand size=visit(node.getDimArgs().get(index));
  Operand bitSize=visitArithComp(visitArithComp(size,MUL,PTR_SIZE,INT_TYPE_SYMBOL),ADD,LENGTH_SIZE,INT_TYPE_SYMBOL);
  currentBasicBlock.pushBack(new FunctionCallInst(Function.MALLOC,new ArrayList<>(Collections.singletonList(bitSize)),baseReg),valTag);
  currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,null,0,0),size),valTag);
  Boolean terminal=index == node.getDimArgs().size() - 1;
  Boolean createClass=!node.getCreateType().isPrimitiveTypeBase() && node.getEmptyDim() == 0;
  if (!terminal || createClass) {
    Var indexReg=Var.builder("String_Node_Str");
    currentBasicBlock.pushBack(new MoveInst(indexReg,ZERO_LITERAL),valTag);
    BasicBlock creatorLoopBegin=new BasicBlock(currentBasicBlock.getParentFunction(),new SymbolTable(currentSymbolTable),"String_Node_Str");
    BasicBlock next=new BasicBlock(currentBasicBlock.getParentFunction(),currentSymbolTable,"String_Node_Str");
    currentBasicBlock.pushBack(new DirectJumpInst(creatorLoopBegin));
    setCurrentEnv(creatorLoopBegin);
    newValTag();
    Operand created;
    if (!terminal)     created=visitCreateArray(node,index + 1);
 else     created=visitCreateClass(node.getCreateType().getBaseType());
    currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,indexReg,options.PTR_SIZE,options.LENGTH_SIZE),created),valTag);
    Operand indexTmp=visitArithComp(indexReg,ADD,ONE_LITERAL,INT_TYPE_SYMBOL);
    resetCurrentBasicBlockBackDst(indexReg,indexTmp,INT_TYPE_SYMBOL);
    Operand ltTmp=visitArithComp(indexReg,LT,size,INT_TYPE_SYMBOL);
    currentBasicBlock.pushBack(new CondJumpInst(ltTmp,creatorLoopBegin,next));
    popValTag();
    setCurrentEnv(next);
  }
  return baseReg;
}

Fixed version (ground truth):
private Operand visitCreateArray(NewExprNode node,Integer index){
  Var baseReg=Var.tmpBuilder("String_Node_Str");
  Operand size=visit(node.getDimArgs().get(index));
  Operand bitSize=visitArithComp(visitArithComp(size,MUL,PTR_SIZE,INT_TYPE_SYMBOL),ADD,LENGTH_SIZE,INT_TYPE_SYMBOL);
  currentBasicBlock.pushBack(new FunctionCallInst(Function.MALLOC,new ArrayList<>(Collections.singletonList(bitSize)),baseReg),valTag);
  currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,null,0,0),size),valTag);
  Boolean terminal=index == node.getDimArgs().size() - 1;
  Boolean createClass=!node.getCreateType().isPrimitiveTypeBase() && node.getEmptyDim() == 0;
  if (!terminal || createClass) {
    Var indexReg=Var.tmpBuilder("String_Node_Str");
    currentBasicBlock.pushBack(new MoveInst(indexReg,ZERO_LITERAL),valTag);
    BasicBlock creatorLoopBegin=new BasicBlock(currentBasicBlock.getParentFunction(),SymbolTable.builder(currentSymbolTable),"String_Node_Str");
    BasicBlock next=new BasicBlock(currentBasicBlock.getParentFunction(),currentSymbolTable,"String_Node_Str");
    currentBasicBlock.pushBack(new DirectJumpInst(creatorLoopBegin));
    setCurrentEnv(creatorLoopBegin);
    newValTag();
    Operand created;
    if (!terminal)     created=visitCreateArray(node,index + 1);
 else     created=visitCreateClass(node.getCreateType().getBaseType());
    currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,indexReg,options.PTR_SIZE,options.LENGTH_SIZE),created),valTag);
    Operand indexTmp=visitArithComp(indexReg,ADD,ONE_LITERAL,INT_TYPE_SYMBOL);
    resetCurrentBasicBlockBackDst(indexReg,indexTmp,INT_TYPE_SYMBOL);
    Operand ltTmp=visitArithComp(indexReg,LT,size,INT_TYPE_SYMBOL);
    currentBasicBlock.pushBack(new CondJumpInst(ltTmp,creatorLoopBegin,next));
    popValTag();
    setCurrentEnv(next);
  }
  return baseReg;
}