Program: 61579
Project: 61579
Buggy source:
@Override protected List<GraphTargetItem> check(GraphSource code,BaseLocalData localData,List<GraphPart> allParts,TranslateStack stack,GraphPart parent,GraphPart part,List<GraphPart> stopPart,List<Loop> loops,List<GraphTargetItem> output,Loop currentLoop,int staticOperation,String path) throws InterruptedException {
  List<GraphTargetItem> ret=null;
  AVM2LocalData aLocalData=(AVM2LocalData)localData;
  List<ABCException> parsedExceptions=aLocalData.parsedExceptions;
  List<Integer> finallyJumps=aLocalData.finallyJumps;
  List<Integer> ignoredSwitches=aLocalData.ignoredSwitches;
  int ip=part.start;
  int addr=this.avm2code.fixAddrAfterDebugLine(this.avm2code.pos2adr(part.start));
  int maxend=-1;
  List<ABCException> catchedExceptions=new ArrayList<>();
  for (int e=0; e < body.exceptions.length; e++) {
    if (addr == this.avm2code.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.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end);
          catchedExceptions.add(body.exceptions[e]);
        }
 else         if (this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
          catchedExceptions.add(body.exceptions[e]);
        }
      }
    }
  }
  if (catchedExceptions.size() > 0) {
    parsedExceptions.addAll(catchedExceptions);
    int endpos=code.adr2pos(this.avm2code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
    int endposStartBlock=code.adr2pos(catchedExceptions.get(0).end);
    List<List<GraphTargetItem>> catchedCommands=new ArrayList<>();
    if (this.avm2code.code.get(endpos).definition instanceof JumpIns) {
      int afterCatchAddr=this.avm2code.pos2adr(endpos + 1) + this.avm2code.code.get(endpos).operands[0];
      int afterCatchPos=this.avm2code.adr2pos(afterCatchAddr);
      final AVM2Graph t=this;
      Collections.sort(catchedExceptions,new Comparator<ABCException>(){
        @Override public int compare(        ABCException o1,        ABCException o2){
          return t.avm2code.fixAddrAfterDebugLine(o1.target) - t.avm2code.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.avm2code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
            if (afterCatchPos + 1 == code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
              AVM2Instruction jmpIns=this.avm2code.code.get(code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end)));
              if (jmpIns.definition instanceof JumpIns) {
                int finStart=code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
                GraphPart fpart=null;
                for (                GraphPart p : allParts) {
                  if (p.start == finStart) {
                    fpart=p;
                    break;
                  }
                }
                int swPos=-1;
                for (int f=finStart; f < this.avm2code.code.size(); f++) {
                  if (this.avm2code.code.get(f).definition instanceof LookupSwitchIns) {
                    AVM2Instruction swins=this.avm2code.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;
                            }
                          }
                          swPos=f;
                          List<GraphPart> stopPart2=new ArrayList<>(stopPart);
                          stopPart2.add(fepart);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                List<Integer> oldFinallyJumps=new ArrayList<>(finallyJumps);
                finallyJumps.clear();
                ignoredSwitches.add(swPos);
                finallyCommands=printGraph(localData,stack,allParts,parent,fpart,null,loops,staticOperation,path);
                finallyJumps.addAll(oldFinallyJumps);
                finallyJumps.add(finStart);
                break;
              }
            }
          }
        }
      }
      GraphPart retPart=null;
      for (      GraphPart p : allParts) {
        if (p.start == returnPos) {
          retPart=p;
          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.avm2code.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)));
        AVM2LocalData localData2=new AVM2LocalData(aLocalData);
        localData2.scopeStack=new ScopeStack();
        List<GraphPart> stopPart2=new ArrayList<>(stopPart);
        stopPart2.add(nepart);
        if (retPart != null) {
          stopPart2.add(retPart);
        }
        catchedCommands.add(printGraph(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);
      if (retPart != null) {
        stopPart2.add(retPart);
      }
      List<GraphTargetItem> tryCommands=printGraph(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(localData,stack,allParts,null,part,stopPart,loops,staticOperation,path));
    }
 else {
      ret.add(lop);
    }
    return ret;
  }
  if (part.nextParts.isEmpty()) {
    if (this.avm2code.code.get(part.end).definition instanceof ReturnValueIns) {
      if (part.getHeight() >= 3) {
        if (this.avm2code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) {
          if (this.avm2code.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.avm2code.code.get(part.end),((SetLocalAVM2Item)output.get(output.size() - 2)).value));
                return ret;
              }
            }
          }
        }
      }
    }
  }
  if ((this.avm2code.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.avm2code.code.get(this.avm2code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(0).nextParts.isEmpty())&& (this.avm2code.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.avm2code.code.get(this.avm2code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(1).nextParts.isEmpty())&& (this.avm2code.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.avm2code.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.avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (this.avm2code.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.avm2code.code.get(part.end).definition instanceof IfStrictNeIns) {
        reversed=false;
      }
 else {
        reversed=true;
      }
      GraphPart numPart=part.nextParts.get(reversed ? 0 : 1);
      AVM2Instruction ins=null;
      TranslateStack sstack=new TranslateStack();
      do {
        for (int n=0; n < numPart.getHeight(); n++) {
          ins=this.avm2code.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.avm2code.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.avm2code.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.avm2code.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;
    TranslateStack sstack=new TranslateStack();
    do {
      for (int n=0; n < numPart.getHeight(); n++) {
        ins=this.avm2code.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.avm2code.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(localData,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(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(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(localData,stack,allParts,null,next,stopPart,loops,staticOperation,path));
    }
  }
  return ret;
}

Fixed version (ground truth):
@Override protected List<GraphTargetItem> check(GraphSource code,BaseLocalData localData,List<GraphPart> allParts,TranslateStack stack,GraphPart parent,GraphPart part,List<GraphPart> stopPart,List<Loop> loops,List<GraphTargetItem> output,Loop currentLoop,int staticOperation,String path) throws InterruptedException {
  List<GraphTargetItem> ret=null;
  AVM2LocalData aLocalData=(AVM2LocalData)localData;
  List<ABCException> parsedExceptions=aLocalData.parsedExceptions;
  List<Integer> finallyJumps=aLocalData.finallyJumps;
  List<Integer> ignoredSwitches=aLocalData.ignoredSwitches;
  int ip=part.start;
  int addr=this.avm2code.fixAddrAfterDebugLine(this.avm2code.pos2adr(part.start));
  int maxend=-1;
  List<ABCException> catchedExceptions=new ArrayList<>();
  for (int e=0; e < body.exceptions.length; e++) {
    if (addr == this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
      if (!body.exceptions[e].isFinally() || catchedExceptions.isEmpty()) {
        if (!parsedExceptions.contains(body.exceptions[e])) {
          if (((body.exceptions[e].end) > maxend)) {
            catchedExceptions.clear();
            maxend=this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end);
            catchedExceptions.add(body.exceptions[e]);
          }
 else           if (this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
            catchedExceptions.add(body.exceptions[e]);
          }
        }
      }
 else       if (body.exceptions[e].isFinally()) {
        parsedExceptions.add(body.exceptions[e]);
      }
    }
  }
  if (catchedExceptions.size() > 0) {
    parsedExceptions.addAll(catchedExceptions);
    int endpos=code.adr2pos(this.avm2code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
    int endposStartBlock=code.adr2pos(catchedExceptions.get(0).end);
    List<List<GraphTargetItem>> catchedCommands=new ArrayList<>();
    if (this.avm2code.code.get(endpos).definition instanceof JumpIns) {
      int afterCatchAddr=this.avm2code.pos2adr(endpos + 1) + this.avm2code.code.get(endpos).operands[0];
      int afterCatchPos=this.avm2code.adr2pos(afterCatchAddr);
      final AVM2Graph t=this;
      Collections.sort(catchedExceptions,new Comparator<ABCException>(){
        @Override public int compare(        ABCException o1,        ABCException o2){
          return t.avm2code.fixAddrAfterDebugLine(o1.target) - t.avm2code.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.avm2code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
            if (afterCatchPos + 1 == code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
              AVM2Instruction jmpIns=this.avm2code.code.get(code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end)));
              if (jmpIns.definition instanceof JumpIns) {
                int finStart=code.adr2pos(this.avm2code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]);
                GraphPart fpart=null;
                for (                GraphPart p : allParts) {
                  if (p.start == finStart) {
                    fpart=p;
                    break;
                  }
                }
                int swPos=-1;
                for (int f=finStart; f < this.avm2code.code.size(); f++) {
                  if (this.avm2code.code.get(f).definition instanceof LookupSwitchIns) {
                    AVM2Instruction swins=this.avm2code.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;
                            }
                          }
                          swPos=f;
                          List<GraphPart> stopPart2=new ArrayList<>(stopPart);
                          stopPart2.add(fepart);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                List<Integer> oldFinallyJumps=new ArrayList<>(finallyJumps);
                finallyJumps.clear();
                ignoredSwitches.add(swPos);
                finallyCommands=printGraph(localData,stack,allParts,parent,fpart,null,loops,staticOperation,path);
                finallyJumps.addAll(oldFinallyJumps);
                finallyJumps.add(finStart);
                break;
              }
            }
          }
        }
      }
      GraphPart retPart=null;
      for (      GraphPart p : allParts) {
        if (p.start == returnPos) {
          retPart=p;
          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.avm2code.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)));
        AVM2LocalData localData2=new AVM2LocalData(aLocalData);
        localData2.scopeStack=new ScopeStack();
        List<GraphPart> stopPart2=new ArrayList<>(stopPart);
        stopPart2.add(nepart);
        if (retPart != null) {
          stopPart2.add(retPart);
        }
        catchedCommands.add(printGraph(localData2,stack,allParts,parent,npart,stopPart2,loops,staticOperation,path));
        if (catchedExceptions.get(e).isFinally()) {
          catchedCommands.remove(catchedCommands.size() - 1);
          catchedExceptions.remove(e);
          e--;
        }
      }
      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);
      if (retPart != null) {
        stopPart2.add(retPart);
      }
      List<GraphTargetItem> tryCommands=printGraph(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(localData,stack,allParts,null,part,stopPart,loops,staticOperation,path));
    }
 else {
      ret.add(lop);
    }
    return ret;
  }
  if (part.nextParts.isEmpty()) {
    if (this.avm2code.code.get(part.end).definition instanceof ReturnValueIns) {
      if (part.getHeight() >= 3) {
        if (this.avm2code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) {
          if (this.avm2code.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.avm2code.code.get(part.end),((SetLocalAVM2Item)output.get(output.size() - 2)).value));
                return ret;
              }
            }
          }
        }
      }
    }
  }
  if ((this.avm2code.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.avm2code.code.get(this.avm2code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(0).nextParts.isEmpty())&& (this.avm2code.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.avm2code.code.get(this.avm2code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)&& (!part.nextParts.get(1).nextParts.isEmpty())&& (this.avm2code.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.avm2code.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.avm2code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (this.avm2code.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.avm2code.code.get(part.end).definition instanceof IfStrictNeIns) {
        reversed=false;
      }
 else {
        reversed=true;
      }
      GraphPart numPart=part.nextParts.get(reversed ? 0 : 1);
      AVM2Instruction ins=null;
      TranslateStack sstack=new TranslateStack();
      do {
        for (int n=0; n < numPart.getHeight(); n++) {
          ins=this.avm2code.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.avm2code.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.avm2code.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.avm2code.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;
    TranslateStack sstack=new TranslateStack();
    do {
      for (int n=0; n < numPart.getHeight(); n++) {
        ins=this.avm2code.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.avm2code.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(localData,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(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(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(localData,stack,allParts,null,next,stopPart,loops,staticOperation,path));
    }
  }
  return ret;
}