Program: 62042
Project: 62042
Buggy source:
@Override protected List<GraphTargetItem> check(GraphSource code,List<Object> localData,List<GraphPart> allParts,Stack<GraphTargetItem> stack,GraphPart parent,GraphPart part,List<GraphPart> stopPart,List<Loop> loops,List<GraphTargetItem> output,Loop currentLoop,int staticOperation,String path){
  List<GraphTargetItem> ret=null;
  @SuppressWarnings("String_Node_Str") List<ABCException> parsedExceptions=(List<ABCException>)localData.get(DATA_PARSEDEXCEPTIONS);
  @SuppressWarnings("String_Node_Str") List<Integer> finallyJumps=(List<Integer>)localData.get(DATA_FINALLYJUMPS);
  @SuppressWarnings("String_Node_Str") List<Integer> ignoredSwitches=(List<Integer>)localData.get(DATA_IGNOREDSWITCHES);
  int ip=part.start;
  int addr=this.code.fixAddrAfterDebugLine(this.code.pos2adr(part.start));
  int maxend=-1;
  List<ABCException> catchedExceptions=new ArrayList<>();
  for (int e=0; e < body.exceptions.length; e++) {
    if (addr == this.code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
      if (!body.exceptions[e].isFinally()) {
        if (((body.exceptions[e].end) > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) {
          catchedExceptions.clear();
          maxend=this.code.fixAddrAfterDebugLine(body.exceptions[e].end);
          catchedExceptions.add(body.exceptions[e]);
        }
 else         if (this.code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
          catchedExceptions.add(body.exceptions[e]);
        }
      }
    }
  }
  if (catchedExceptions.size() > 0) {
    parsedExceptions.addAll(catchedExceptions);
    int endpos=code.adr2pos(this.code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
    int endposStartBlock=code.adr2pos(catchedExceptions.get(0).end);
    List<List<GraphTargetItem>> catchedCommands=new ArrayList<>();
    if (this.code.code.get(endpos).definition instanceof JumpIns) {
      int afterCatchAddr=this.code.pos2adr(endpos + 1) + this.code.code.get(endpos).operands[0];
      int afterCatchPos=this.code.adr2pos(afterCatchAddr);
      final AVM2Graph t=this;
      Collections.sort(catchedExceptions,new Comparator<ABCException>(){
        @Override public int compare(        ABCException o1,        ABCException o2){
          return t.code.fixAddrAfterDebugLine(o1.target) - t.code.fixAddrAfterDebugLine(o2.target);
        }
      }
);
      List<GraphTargetItem> finallyCommands=new ArrayList<>();
      int returnPos=afterCatchPos;
      for (int e=0; e < body.exceptions.length; e++) {
        if (body.exceptions[e].isFinally()) {
          if (addr == this.code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
            if (afterCatchPos + 1 == code.adr2pos(this.code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
              AVM2Instruction jmpIns=this.code.code.get(code.adr2pos(this.code.fixAddrAfterDebugLine(body.exceptions[e].end)));
              if (jmpIns.definition instanceof JumpIns) {
                int finStart=code.adr2pos(this.code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
                boolean switchFound=false;
                GraphPart fpart=null;
                for (                GraphPart p : allParts) {
                  if (p.start == finStart) {
                    fpart=p;
                    break;
                  }
                }
                for (int f=finStart; f < this.code.code.size(); f++) {
                  if (this.code.code.get(f).definition instanceof LookupSwitchIns) {
                    AVM2Instruction swins=this.code.code.get(f);
                    if (swins.operands.length >= 3) {
                      if (swins.operands[0] == swins.getBytes().length) {
                        if (code.adr2pos(code.pos2adr(f) + swins.operands[2]) < finStart) {
                          stack.push(new ExceptionAVM2Item(body.exceptions[e]));
                          GraphPart fepart=null;
                          for (                          GraphPart p : allParts) {
                            if (p.start == f + 1) {
                              fepart=p;
                              break;
                            }
                          }
                          ignoredSwitches.add(f);
                          List<GraphPart> stopPart2=new ArrayList<>(stopPart);
                          stopPart2.add(fepart);
                          finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,stopPart2,loops,staticOperation,path);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                if (!switchFound) {
                  finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,null,loops,staticOperation,path);
                }
                finallyJumps.add(finStart);
                break;
              }
            }
          }
        }
      }
      List<GraphPart> catchParts=new ArrayList<>();
      for (int e=0; e < catchedExceptions.size(); e++) {
        int eendpos;
        if (e < catchedExceptions.size() - 1) {
          eendpos=code.adr2pos(this.code.fixAddrAfterDebugLine(catchedExceptions.get(e + 1).target)) - 2;
        }
 else {
          eendpos=afterCatchPos - 1;
        }
        GraphPart npart=null;
        int findpos=code.adr2pos(catchedExceptions.get(e).target);
        for (        GraphPart p : allParts) {
          if (p.start == findpos) {
            npart=p;
            catchParts.add(p);
            break;
          }
        }
        GraphPart nepart=null;
        for (        GraphPart p : allParts) {
          if (p.start == eendpos + 1) {
            nepart=p;
            break;
          }
        }
        stack.add(new ExceptionAVM2Item(catchedExceptions.get(e)));
        List<Object> localData2=new ArrayList<>();
        localData2.addAll(localData);
        localData2.set(DATA_SCOPESTACK,new Stack<GraphTargetItem>());
        List<GraphPart> stopPart2=new ArrayList<>(stopPart);
        stopPart2.add(nepart);
        catchedCommands.add(printGraph(new ArrayList<GraphPart>(),localData2,stack,allParts,parent,npart,stopPart2,loops,staticOperation,path));
      }
      GraphPart nepart=null;
      for (      GraphPart p : allParts) {
        if (p.start == endposStartBlock) {
          nepart=p;
          break;
        }
      }
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      stopPart2.add(nepart);
      stopPart2.addAll(catchParts);
      List<GraphTargetItem> tryCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,part,stopPart2,loops,staticOperation,path);
      output.clear();
      output.add(new TryAVM2Item(tryCommands,catchedExceptions,catchedCommands,finallyCommands));
      ip=returnPos;
    }
  }
  if (ip != part.start) {
    part=null;
    for (    GraphPart p : allParts) {
      List<GraphPart> ps=p.getSubParts();
      for (      GraphPart p2 : ps) {
        if (p2.start == ip) {
          part=p2;
          break;
        }
      }
    }
    ret=new ArrayList<>();
    ret.addAll(output);
    GraphTargetItem lop=checkLoop(part,stopPart,loops);
    if (lop == null) {
      ret.addAll(printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,null,part,stopPart,loops,staticOperation,path));
    }
 else {
      ret.add(lop);
    }
    return ret;
  }
  if (part.nextParts.isEmpty()) {
    if (this.code.code.get(part.end).definition instanceof ReturnValueIns) {
      if (part.getHeight() >= 3) {
        if (this.code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) {
          if (this.code.code.get(part.getPosAt(part.getHeight() - 3)).definition instanceof GetLocalTypeIns) {
            if (output.size() >= 2) {
              if (output.get(output.size() - 2) instanceof SetLocalAVM2Item) {
                ret=new ArrayList<>();
                ret.addAll(output);
                ret.remove(ret.size() - 1);
                ret.add(new ReturnValueAVM2Item(this.code.code.get(part.end),((SetLocalAVM2Item)output.get(output.size() - 2)).value));
                return ret;
              }
            }
          }
        }
      }
    }
  }
  if ((this.code.code.get(part.end).definition instanceof LookupSwitchIns) && ignoredSwitches.contains(part.end)) {
    ret=new ArrayList<>();
    ret.addAll(output);
    return ret;
  }
  if (((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictEqAVM2Item)&& (part.nextParts.get(0).getHeight() >= 2)&& (this.code.code.get(this.code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(0).nextParts.isEmpty())&& (this.code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)) || ((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictNeqAVM2Item)&& (part.nextParts.get(1).getHeight() >= 2)&& (this.code.code.get(this.code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(1).nextParts.isEmpty())&& (this.code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) {
    if (stack.peek() instanceof StrictEqAVM2Item) {
      ignoredSwitches.add(part.nextParts.get(0).nextParts.get(0).end);
    }
 else {
      ignoredSwitches.add(part.nextParts.get(1).nextParts.get(0).end);
    }
    ret=new ArrayList<>();
    ret.addAll(output);
    boolean reversed=false;
    if (stack.peek() instanceof StrictEqAVM2Item) {
      reversed=true;
    }
    GraphTargetItem switchedObject=null;
    if (!output.isEmpty()) {
      if (output.get(output.size() - 1) instanceof SetLocalAVM2Item) {
        switchedObject=((SetLocalAVM2Item)output.get(output.size() - 1)).value;
      }
    }
    if (switchedObject == null) {
      switchedObject=new NullAVM2Item(null);
    }
    HashMap<Integer,GraphTargetItem> caseValuesMap=new HashMap<>();
    GraphTargetItem tar=stack.pop();
    if (tar instanceof StrictEqAVM2Item) {
      tar=((StrictEqAVM2Item)tar).leftSide;
    }
    if (tar instanceof StrictNeqAVM2Item) {
      tar=((StrictNeqAVM2Item)tar).leftSide;
    }
    caseValuesMap.put(this.code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0],tar);
    GraphPart switchLoc=part.nextParts.get(reversed ? 0 : 1).nextParts.get(0);
    while ((this.code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (this.code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) {
      part=part.nextParts.get(reversed ? 1 : 0);
      translatePart(localData,part,stack,staticOperation,null);
      tar=stack.pop();
      if (tar instanceof StrictEqAVM2Item) {
        tar=((StrictEqAVM2Item)tar).leftSide;
      }
      if (tar instanceof StrictNeqAVM2Item) {
        tar=((StrictNeqAVM2Item)tar).leftSide;
      }
      if (this.code.code.get(part.end).definition instanceof IfStrictNeIns) {
        reversed=false;
      }
 else {
        reversed=true;
      }
      GraphPart numPart=part.nextParts.get(reversed ? 0 : 1);
      AVM2Instruction ins=null;
      Stack<GraphTargetItem> sstack=new Stack<>();
      do {
        for (int n=0; n < numPart.getHeight(); n++) {
          ins=this.code.code.get(numPart.getPosAt(n));
          if (ins.definition instanceof LookupSwitchIns) {
            break;
          }
          ins.translate(localData,sstack,new ArrayList<GraphTargetItem>(),staticOperation,path);
        }
        if (numPart.nextParts.size() > 1) {
          break;
        }
 else {
          numPart=numPart.nextParts.get(0);
        }
      }
 while (!(this.code.code.get(numPart.end).definition instanceof LookupSwitchIns));
      GraphTargetItem nt=sstack.peek();
      if (!(nt instanceof IntegerValueAVM2Item)) {
        throw new RuntimeException("String_Node_Str");
      }
      IntegerValueAVM2Item iv=(IntegerValueAVM2Item)nt;
      caseValuesMap.put((int)(long)iv.value,tar);
      while (this.code.code.get(part.nextParts.get(reversed ? 1 : 0).start).definition instanceof JumpIns) {
        reversed=false;
        part=part.nextParts.get(reversed ? 1 : 0);
        if (part instanceof GraphPartMulti) {
          part=((GraphPartMulti)part).parts.get(0);
        }
      }
    }
    boolean hasDefault=false;
    GraphPart dp=part.nextParts.get(reversed ? 1 : 0);
    while (this.code.code.get(dp.start).definition instanceof JumpIns) {
      if (dp instanceof GraphPartMulti) {
        dp=((GraphPartMulti)dp).parts.get(0);
      }
      dp=dp.nextParts.get(0);
    }
    if (this.code.code.get(dp.start).definition instanceof PushIntegerTypeIns) {
      hasDefault=true;
    }
    List<GraphTargetItem> caseValues=new ArrayList<>();
    for (int i=0; i < switchLoc.nextParts.size() - 1; i++) {
      if (caseValuesMap.containsKey(i)) {
        caseValues.add(caseValuesMap.get(i));
      }
 else {
        continue;
      }
    }
    List<List<GraphTargetItem>> caseCommands=new ArrayList<>();
    GraphPart next=null;
    next=getMostCommonPart(switchLoc.nextParts,loops);
    currentLoop=new Loop(loops.size(),null,next);
    currentLoop.phase=1;
    loops.add(currentLoop);
    List<Integer> valuesMapping=new ArrayList<>();
    List<GraphPart> caseBodies=new ArrayList<>();
    for (int i=0; i < caseValues.size(); i++) {
      GraphPart cur=switchLoc.nextParts.get(1 + i);
      if (!caseBodies.contains(cur)) {
        caseBodies.add(cur);
      }
      valuesMapping.add(caseBodies.indexOf(cur));
    }
    List<GraphTargetItem> defaultCommands=new ArrayList<>();
    GraphPart defaultPart=null;
    if (hasDefault) {
      defaultPart=switchLoc.nextParts.get(switchLoc.nextParts.size() - 1);
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      stopPart2.add(next);
      defaultCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,defaultPart,stopPart2,loops,staticOperation,path);
      if (!defaultCommands.isEmpty()) {
        if (defaultCommands.get(defaultCommands.size() - 1) instanceof BreakItem) {
          if (((BreakItem)defaultCommands.get(defaultCommands.size() - 1)).loopId == currentLoop.id) {
            defaultCommands.remove(defaultCommands.size() - 1);
          }
        }
      }
    }
    List<GraphPart> ignored=new ArrayList<>();
    for (    Loop l : loops) {
      ignored.add(l.loopContinue);
    }
    for (int i=0; i < caseBodies.size(); i++) {
      List<GraphTargetItem> cc=new ArrayList<>();
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      for (int j=0; j < caseBodies.size(); j++) {
        if (caseBodies.get(j) != caseBodies.get(i)) {
          stopPart2.add(caseBodies.get(j));
        }
      }
      if (hasDefault) {
        stopPart2.add(defaultPart);
      }
      cc.addAll(0,printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,caseBodies.get(i),stopPart2,loops,staticOperation,path));
      caseCommands.add(cc);
    }
    SwitchItem sti=new SwitchItem(null,currentLoop,switchedObject,caseValues,caseCommands,defaultCommands,valuesMapping);
    ret.add(sti);
    if (next != null) {
      currentLoop.phase=2;
      ret.addAll(printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,null,next,stopPart,loops,staticOperation,path));
    }
  }
  return ret;
}

Fixed version (ground truth):
@Override protected List<GraphTargetItem> check(GraphSource code,List<Object> localData,List<GraphPart> allParts,Stack<GraphTargetItem> stack,GraphPart parent,GraphPart part,List<GraphPart> stopPart,List<Loop> loops,List<GraphTargetItem> output,Loop currentLoop,int staticOperation,String path){
  List<GraphTargetItem> ret=null;
  @SuppressWarnings("String_Node_Str") List<ABCException> parsedExceptions=(List<ABCException>)localData.get(DATA_PARSEDEXCEPTIONS);
  @SuppressWarnings("String_Node_Str") List<Integer> finallyJumps=(List<Integer>)localData.get(DATA_FINALLYJUMPS);
  @SuppressWarnings("String_Node_Str") List<Integer> ignoredSwitches=(List<Integer>)localData.get(DATA_IGNOREDSWITCHES);
  int ip=part.start;
  int addr=this.code.fixAddrAfterDebugLine(this.code.pos2adr(part.start));
  int maxend=-1;
  List<ABCException> catchedExceptions=new ArrayList<>();
  for (int e=0; e < body.exceptions.length; e++) {
    if (addr == this.code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
      if (!body.exceptions[e].isFinally()) {
        if (((body.exceptions[e].end) > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) {
          catchedExceptions.clear();
          maxend=this.code.fixAddrAfterDebugLine(body.exceptions[e].end);
          catchedExceptions.add(body.exceptions[e]);
        }
 else         if (this.code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
          catchedExceptions.add(body.exceptions[e]);
        }
      }
    }
  }
  if (catchedExceptions.size() > 0) {
    parsedExceptions.addAll(catchedExceptions);
    int endpos=code.adr2pos(this.code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
    int endposStartBlock=code.adr2pos(catchedExceptions.get(0).end);
    List<List<GraphTargetItem>> catchedCommands=new ArrayList<>();
    if (this.code.code.get(endpos).definition instanceof JumpIns) {
      int afterCatchAddr=this.code.pos2adr(endpos + 1) + this.code.code.get(endpos).operands[0];
      int afterCatchPos=this.code.adr2pos(afterCatchAddr);
      final AVM2Graph t=this;
      Collections.sort(catchedExceptions,new Comparator<ABCException>(){
        @Override public int compare(        ABCException o1,        ABCException o2){
          return t.code.fixAddrAfterDebugLine(o1.target) - t.code.fixAddrAfterDebugLine(o2.target);
        }
      }
);
      List<GraphTargetItem> finallyCommands=new ArrayList<>();
      int returnPos=afterCatchPos;
      for (int e=0; e < body.exceptions.length; e++) {
        if (body.exceptions[e].isFinally()) {
          if (addr == this.code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
            if (afterCatchPos + 1 == code.adr2pos(this.code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
              AVM2Instruction jmpIns=this.code.code.get(code.adr2pos(this.code.fixAddrAfterDebugLine(body.exceptions[e].end)));
              if (jmpIns.definition instanceof JumpIns) {
                int finStart=code.adr2pos(this.code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
                boolean switchFound=false;
                GraphPart fpart=null;
                for (                GraphPart p : allParts) {
                  if (p.start == finStart) {
                    fpart=p;
                    break;
                  }
                }
                for (int f=finStart; f < this.code.code.size(); f++) {
                  if (this.code.code.get(f).definition instanceof LookupSwitchIns) {
                    AVM2Instruction swins=this.code.code.get(f);
                    if (swins.operands.length >= 3) {
                      if (swins.operands[0] == swins.getBytes().length) {
                        if (code.adr2pos(code.pos2adr(f) + swins.operands[2]) < finStart) {
                          stack.push(new ExceptionAVM2Item(body.exceptions[e]));
                          GraphPart fepart=null;
                          for (                          GraphPart p : allParts) {
                            if (p.start == f + 1) {
                              fepart=p;
                              break;
                            }
                          }
                          ignoredSwitches.add(f);
                          List<GraphPart> stopPart2=new ArrayList<>(stopPart);
                          stopPart2.add(fepart);
                          finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,stopPart2,loops,staticOperation,path);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                if (!switchFound) {
                  finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,null,loops,staticOperation,path);
                }
                finallyJumps.add(finStart);
                break;
              }
            }
          }
        }
      }
      List<GraphPart> catchParts=new ArrayList<>();
      for (int e=0; e < catchedExceptions.size(); e++) {
        int eendpos;
        if (e < catchedExceptions.size() - 1) {
          eendpos=code.adr2pos(this.code.fixAddrAfterDebugLine(catchedExceptions.get(e + 1).target)) - 2;
        }
 else {
          eendpos=afterCatchPos - 1;
        }
        GraphPart npart=null;
        int findpos=code.adr2pos(catchedExceptions.get(e).target);
        for (        GraphPart p : allParts) {
          if (p.start == findpos) {
            npart=p;
            catchParts.add(p);
            break;
          }
        }
        GraphPart nepart=null;
        for (        GraphPart p : allParts) {
          if (p.start == eendpos + 1) {
            nepart=p;
            break;
          }
        }
        stack.add(new ExceptionAVM2Item(catchedExceptions.get(e)));
        List<Object> localData2=new ArrayList<>();
        localData2.addAll(localData);
        localData2.set(DATA_SCOPESTACK,new Stack<GraphTargetItem>());
        List<GraphPart> stopPart2=new ArrayList<>(stopPart);
        stopPart2.add(nepart);
        catchedCommands.add(printGraph(new ArrayList<GraphPart>(),localData2,stack,allParts,parent,npart,stopPart2,loops,staticOperation,path));
      }
      GraphPart nepart=null;
      for (      GraphPart p : allParts) {
        if (p.start == endposStartBlock) {
          nepart=p;
          break;
        }
      }
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      stopPart2.add(nepart);
      stopPart2.addAll(catchParts);
      List<GraphTargetItem> tryCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,part,stopPart2,loops,staticOperation,path);
      output.clear();
      output.add(new TryAVM2Item(tryCommands,catchedExceptions,catchedCommands,finallyCommands));
      ip=returnPos;
    }
  }
  if (ip != part.start) {
    part=null;
    for (    GraphPart p : allParts) {
      List<GraphPart> ps=p.getSubParts();
      for (      GraphPart p2 : ps) {
        if (p2.start == ip) {
          part=p2;
          break;
        }
      }
    }
    ret=new ArrayList<>();
    ret.addAll(output);
    GraphTargetItem lop=checkLoop(part,stopPart,loops);
    if (lop == null) {
      ret.addAll(printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,null,part,stopPart,loops,staticOperation,path));
    }
 else {
      ret.add(lop);
    }
    return ret;
  }
  if (part.nextParts.isEmpty()) {
    if (this.code.code.get(part.end).definition instanceof ReturnValueIns) {
      if (part.getHeight() >= 3) {
        if (this.code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) {
          if (this.code.code.get(part.getPosAt(part.getHeight() - 3)).definition instanceof GetLocalTypeIns) {
            if (output.size() >= 2) {
              if (output.get(output.size() - 2) instanceof SetLocalAVM2Item) {
                ret=new ArrayList<>();
                ret.addAll(output);
                ret.remove(ret.size() - 1);
                ret.add(new ReturnValueAVM2Item(this.code.code.get(part.end),((SetLocalAVM2Item)output.get(output.size() - 2)).value));
                return ret;
              }
            }
          }
        }
      }
    }
  }
  if ((this.code.code.get(part.end).definition instanceof LookupSwitchIns) && ignoredSwitches.contains(part.end)) {
    ret=new ArrayList<>();
    ret.addAll(output);
    return ret;
  }
  if (((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictEqAVM2Item)&& (part.nextParts.get(0).getHeight() >= 2)&& (this.code.code.get(this.code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(0).nextParts.isEmpty())&& (this.code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)) || ((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictNeqAVM2Item)&& (part.nextParts.get(1).getHeight() >= 2)&& (this.code.code.get(this.code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(1).nextParts.isEmpty())&& (this.code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) {
    if (stack.peek() instanceof StrictEqAVM2Item) {
      ignoredSwitches.add(part.nextParts.get(0).nextParts.get(0).end);
    }
 else {
      ignoredSwitches.add(part.nextParts.get(1).nextParts.get(0).end);
    }
    ret=new ArrayList<>();
    ret.addAll(output);
    boolean reversed=false;
    if (stack.peek() instanceof StrictEqAVM2Item) {
      reversed=true;
    }
    GraphTargetItem switchedObject=null;
    if (!output.isEmpty()) {
      if (output.get(output.size() - 1) instanceof SetLocalAVM2Item) {
        switchedObject=((SetLocalAVM2Item)output.get(output.size() - 1)).value;
      }
    }
    if (switchedObject == null) {
      switchedObject=new NullAVM2Item(null);
    }
    HashMap<Integer,GraphTargetItem> caseValuesMap=new HashMap<>();
    GraphTargetItem tar=stack.pop();
    if (tar instanceof StrictEqAVM2Item) {
      tar=((StrictEqAVM2Item)tar).leftSide;
    }
    if (tar instanceof StrictNeqAVM2Item) {
      tar=((StrictNeqAVM2Item)tar).leftSide;
    }
    caseValuesMap.put(this.code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0],tar);
    GraphPart switchLoc=part.nextParts.get(reversed ? 0 : 1).nextParts.get(0);
    while ((this.code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (this.code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) {
      part=part.nextParts.get(reversed ? 1 : 0);
      translatePart(localData,part,stack,staticOperation,null);
      tar=stack.pop();
      if (tar instanceof StrictEqAVM2Item) {
        tar=((StrictEqAVM2Item)tar).leftSide;
      }
      if (tar instanceof StrictNeqAVM2Item) {
        tar=((StrictNeqAVM2Item)tar).leftSide;
      }
      if (this.code.code.get(part.end).definition instanceof IfStrictNeIns) {
        reversed=false;
      }
 else {
        reversed=true;
      }
      GraphPart numPart=part.nextParts.get(reversed ? 0 : 1);
      AVM2Instruction ins=null;
      Stack<GraphTargetItem> sstack=new Stack<>();
      do {
        for (int n=0; n < numPart.getHeight(); n++) {
          ins=this.code.code.get(numPart.getPosAt(n));
          if (ins.definition instanceof LookupSwitchIns) {
            break;
          }
          ins.translate(localData,sstack,new ArrayList<GraphTargetItem>(),staticOperation,path);
        }
        if (numPart.nextParts.size() > 1) {
          break;
        }
 else {
          numPart=numPart.nextParts.get(0);
        }
      }
 while (!(this.code.code.get(numPart.end).definition instanceof LookupSwitchIns));
      GraphTargetItem nt=sstack.peek();
      if (!(nt instanceof IntegerValueAVM2Item)) {
        throw new RuntimeException("String_Node_Str");
      }
      IntegerValueAVM2Item iv=(IntegerValueAVM2Item)nt;
      caseValuesMap.put((int)(long)iv.value,tar);
      while (this.code.code.get(part.nextParts.get(reversed ? 1 : 0).start).definition instanceof JumpIns) {
        reversed=false;
        part=part.nextParts.get(reversed ? 1 : 0);
        if (part instanceof GraphPartMulti) {
          part=((GraphPartMulti)part).parts.get(0);
        }
      }
    }
    boolean hasDefault=false;
    GraphPart dp=part.nextParts.get(reversed ? 1 : 0);
    while (this.code.code.get(dp.start).definition instanceof JumpIns) {
      if (dp instanceof GraphPartMulti) {
        dp=((GraphPartMulti)dp).parts.get(0);
      }
      dp=dp.nextParts.get(0);
    }
    GraphPart numPart=dp;
    AVM2Instruction ins=null;
    Stack<GraphTargetItem> sstack=new Stack<>();
    do {
      for (int n=0; n < numPart.getHeight(); n++) {
        ins=this.code.code.get(numPart.getPosAt(n));
        if (ins.definition instanceof LookupSwitchIns) {
          break;
        }
        ins.translate(localData,sstack,new ArrayList<GraphTargetItem>(),staticOperation,path);
      }
      if (numPart.nextParts.size() > 1) {
        break;
      }
 else {
        numPart=numPart.nextParts.get(0);
      }
    }
 while (!(this.code.code.get(numPart.end).definition instanceof LookupSwitchIns));
    GraphTargetItem nt=sstack.peek();
    if (nt instanceof IntegerValueAVM2Item) {
      hasDefault=true;
    }
    List<GraphTargetItem> caseValues=new ArrayList<>();
    for (int i=0; i < switchLoc.nextParts.size() - 1; i++) {
      if (caseValuesMap.containsKey(i)) {
        caseValues.add(caseValuesMap.get(i));
      }
 else {
        continue;
      }
    }
    List<List<GraphTargetItem>> caseCommands=new ArrayList<>();
    GraphPart next=null;
    next=getMostCommonPart(switchLoc.nextParts,loops);
    currentLoop=new Loop(loops.size(),null,next);
    currentLoop.phase=1;
    loops.add(currentLoop);
    List<Integer> valuesMapping=new ArrayList<>();
    List<GraphPart> caseBodies=new ArrayList<>();
    for (int i=0; i < caseValues.size(); i++) {
      GraphPart cur=switchLoc.nextParts.get(1 + i);
      if (!caseBodies.contains(cur)) {
        caseBodies.add(cur);
      }
      valuesMapping.add(caseBodies.indexOf(cur));
    }
    List<GraphTargetItem> defaultCommands=new ArrayList<>();
    GraphPart defaultPart=null;
    if (hasDefault) {
      defaultPart=switchLoc.nextParts.get(switchLoc.nextParts.size() - 1);
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      stopPart2.add(next);
      defaultCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,defaultPart,stopPart2,loops,staticOperation,path);
      if (!defaultCommands.isEmpty()) {
        if (defaultCommands.get(defaultCommands.size() - 1) instanceof BreakItem) {
          if (((BreakItem)defaultCommands.get(defaultCommands.size() - 1)).loopId == currentLoop.id) {
            defaultCommands.remove(defaultCommands.size() - 1);
          }
        }
      }
    }
    List<GraphPart> ignored=new ArrayList<>();
    for (    Loop l : loops) {
      ignored.add(l.loopContinue);
    }
    for (int i=0; i < caseBodies.size(); i++) {
      List<GraphTargetItem> cc=new ArrayList<>();
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      for (int j=0; j < caseBodies.size(); j++) {
        if (caseBodies.get(j) != caseBodies.get(i)) {
          stopPart2.add(caseBodies.get(j));
        }
      }
      if (hasDefault) {
        stopPart2.add(defaultPart);
      }
      cc.addAll(0,printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,caseBodies.get(i),stopPart2,loops,staticOperation,path));
      caseCommands.add(cc);
    }
    SwitchItem sti=new SwitchItem(null,currentLoop,switchedObject,caseValues,caseCommands,defaultCommands,valuesMapping);
    ret.add(sti);
    if (next != null) {
      currentLoop.phase=2;
      ret.addAll(printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,null,next,stopPart,loops,staticOperation,path));
    }
  }
  return ret;
}