Program: 171603
Project: 171603
Buggy source:
/** 
 * @param ROM
 * @param call
 */
public static void compileCall(ArrayList<Command> ROM,CallStatement call){
  ArrayList<Subroutine> oldsubs=new ArrayList<Subroutine>();
  oldsubs.addAll(subs);
  subs.clear();
  subs.addAll(call.cursubs);
  ArrayList<Command> tempROM=new ArrayList<Command>();
  ArrayList<Command> pointerROM=new ArrayList<Command>();
  tokens.addAll(0,call.statement);
  tokens.remove(0);
  Arg pointer=null;
  String eq=null;
  if (call.pointerName() == null) {
    pointer=mallocS();
  }
 else {
    pointer=compileRef(pointerROM,true);
    eq=tokens.remove(0);
    tempROM.addAll(pointerROM);
  }
  String subName=tokens.remove(0);
  Subroutine sub=subroutine.get(subName);
  if (sub == null) {
    System.err.print("String_Node_Str" + subName + rmStatement());
    return;
  }
  Arg temp=mallocS();
  int ID=OpenLoop.nextLoopID++;
  tempROM.add(new Command("String_Node_Str",new Arg(1,CallStackPointer,0),new Arg(1),temp));
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(1,subName,0),new Arg(1,temp.val)));
  freeS(temp);
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(1,CallStackPointer,0),pointer));
  tokens.remove(0);
  if (tokens.get(0).equals("String_Node_Str")) {
    tokens.remove(0);
  }
  int argnum=2;
  ArrayList<Command> defArgROM=new ArrayList<Command>();
  for (; !tokens.get(0).equals("String_Node_Str") && !tokens.get(0).equals("String_Node_Str"); argnum++) {
    if (tokens.get(0).equals("String_Node_Str")) {
      tokens.remove(0);
      defArgROM.addAll(sub.inits.get(argnum));
    }
 else {
      String argName=sub.args.get(argnum);
      String varName=tokens.get(0);
      if (tokens.get(1).equals("String_Node_Str")) {
        System.err.println("String_Node_Str" + rmStatement());
      }
 else       if (arrayType.equals(varName)) {
        System.err.println("String_Node_Str" + rmStatement());
      }
 else {
        Arg source=compileRef(tempROM,false);
        tokens.remove(0);
        temp=mallocS();
        tempROM.add(new Command("String_Node_Str",new Arg(pointer.mode + 1,pointer.val),new Arg(argName,0,subName),temp));
        tempROM.add(new Command("String_Node_Str",new Arg(-1),source,new Arg(1,temp.val)));
        freeS(temp);
      }
    }
  }
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(pointer.mode + 1,pointer.val),new Arg(subName,0)));
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg("String_Node_Str" + ID + "String_Node_Str"+ subName,1),new Arg(1,subName,0)));
  tempROM.addAll(defArgROM);
  for (; argnum < sub.args.size(); argnum++) {
    tempROM.addAll(sub.inits.get(argnum));
  }
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg("String_Node_Str" + sub.loop,1),new Arg(ProgramCounter,0)));
  tempROM.add(new Command("String_Node_Str",new Arg(sub.firstFreeRAM),new Arg(1,sub.name,0),new Arg(CallStackPointer,0)));
  tempROM.get(tempROM.size() - 1).tags.add("String_Node_Str" + ID + "String_Node_Str"+ subName);
  tempROM.get(tempROM.size() - 1).tags.addAll(call.tags);
  if (tokens.remove(0).equals("String_Node_Str")) {
    String varname="String_Node_Str";
    while (!tokens.get(0).equals("String_Node_Str")) {
      varname+=tokens.remove(0);
    }
    tokens.remove(0);
    tempROM.addAll(pointerROM);
    if (eq.equals("String_Node_Str")) {
      tempROM.add(new Command("String_Node_Str",new Arg(pointer.mode + 1,pointer.val),new Arg(varname,0,sub.name),pointer));
      tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(pointer.mode + 2,pointer.val),pointer));
    }
 else {
      System.err.println("String_Node_Str" + eq);
    }
  }
  ROM.addAll(call.loc,tempROM);
  subs.clear();
  subs.addAll(oldsubs);
}

Fixed version (ground truth):
/** 
 * @param ROM
 * @param call
 */
public static void compileCall(ArrayList<Command> ROM,CallStatement call){
  ArrayList<Subroutine> oldsubs=new ArrayList<Subroutine>();
  oldsubs.addAll(subs);
  subs.clear();
  subs.addAll(call.cursubs);
  ArrayList<Command> tempROM=new ArrayList<Command>();
  ArrayList<Command> pointerROM=new ArrayList<Command>();
  tokens.addAll(0,call.statement);
  tokens.remove(0);
  Arg pointer=null;
  Arg theOGpointer=null;
  String eq=null;
  if (call.pointerName() == null) {
    pointer=mallocS();
  }
 else {
    pointer=compileRef(pointerROM,true);
    theOGpointer=pointer;
    eq=tokens.remove(0);
    if (call.returnsPointer) {
      tempROM.addAll(pointerROM);
    }
 else {
      pointer=mallocS();
    }
  }
  String subName=tokens.remove(0);
  Subroutine sub=subroutine.get(subName);
  if (sub == null) {
    System.err.print("String_Node_Str" + subName + rmStatement());
    return;
  }
  Arg temp=mallocS();
  int ID=OpenLoop.nextLoopID++;
  tempROM.add(new Command("String_Node_Str",new Arg(1,CallStackPointer,0),new Arg(1),temp));
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(1,subName,0),new Arg(1,temp.val)));
  freeS(temp);
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(1,CallStackPointer,0),pointer));
  tokens.remove(0);
  if (tokens.get(0).equals("String_Node_Str")) {
    tokens.remove(0);
  }
  int argnum=2;
  ArrayList<Command> defArgROM=new ArrayList<Command>();
  for (; !tokens.get(0).equals("String_Node_Str") && !tokens.get(0).equals("String_Node_Str"); argnum++) {
    if (tokens.get(0).equals("String_Node_Str")) {
      tokens.remove(0);
      defArgROM.addAll(sub.inits.get(argnum));
    }
 else {
      String argName=sub.args.get(argnum);
      String varName=tokens.get(0);
      if (tokens.get(1).equals("String_Node_Str")) {
        System.err.println("String_Node_Str" + rmStatement());
      }
 else       if (arrayType.equals(varName)) {
        System.err.println("String_Node_Str" + rmStatement());
      }
 else {
        Arg source=compileRef(tempROM,false);
        tokens.remove(0);
        temp=mallocS();
        tempROM.add(new Command("String_Node_Str",new Arg(pointer.mode + 1,pointer.val),new Arg(argName,0,subName),temp));
        tempROM.add(new Command("String_Node_Str",new Arg(-1),source,new Arg(1,temp.val)));
        freeS(temp);
      }
    }
  }
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(pointer.mode + 1,pointer.val),new Arg(subName,0)));
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg("String_Node_Str" + ID + "String_Node_Str"+ subName,1),new Arg(1,subName,0)));
  freeS(pointer);
  tempROM.addAll(defArgROM);
  for (; argnum < sub.args.size(); argnum++) {
    tempROM.addAll(sub.inits.get(argnum));
  }
  tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg("String_Node_Str" + sub.loop,1),new Arg(ProgramCounter,0)));
  tempROM.add(new Command("String_Node_Str",new Arg(sub.firstFreeRAM),new Arg(1,sub.name,0),new Arg(CallStackPointer,0)));
  tempROM.get(tempROM.size() - 1).tags.add("String_Node_Str" + ID + "String_Node_Str"+ subName);
  tempROM.get(tempROM.size() - 1).tags.addAll(call.tags);
  if (tokens.remove(0).equals("String_Node_Str")) {
    String varname="String_Node_Str";
    while (!tokens.get(0).equals("String_Node_Str")) {
      varname+=tokens.remove(0);
    }
    tokens.remove(0);
    tempROM.addAll(pointerROM);
    if (eq.equals("String_Node_Str")) {
      temp=mallocS();
      tempROM.add(new Command("String_Node_Str",new Arg(1,CallStackPointer,0),new Arg(varname,0,sub.name),temp));
      tempROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(2,temp.val),theOGpointer));
      freeS(temp);
    }
 else {
      System.err.println("String_Node_Str" + eq);
    }
  }
  ROM.addAll(call.loc,tempROM);
  subs.clear();
  subs.addAll(oldsubs);
}