Program: 62149
Project: 62149
Buggy source:
@Override protected List<GraphTargetItem> check(GraphSource srcCode,List<Object> localData,List<GraphPart> allParts,Stack<GraphTargetItem> stack,GraphPart parent,GraphPart part,List<GraphPart> stopPart,List<Loop> loops,List<GraphTargetItem> output,Loop currentLoop){
  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=code.fixAddrAfterDebugLine(code.pos2adr(part.start));
  int maxend=-1;
  List<ABCException> catchedExceptions=new ArrayList<>();
  for (int e=0; e < body.exceptions.length; e++) {
    if (addr == 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=code.fixAddrAfterDebugLine(body.exceptions[e].end);
          catchedExceptions.add(body.exceptions[e]);
        }
 else         if (code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
          catchedExceptions.add(body.exceptions[e]);
        }
      }
    }
  }
  if (catchedExceptions.size() > 0) {
    if (currentLoop != null) {
    }
    parsedExceptions.addAll(catchedExceptions);
    int endpos=code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
    int endposStartBlock=code.adr2pos(catchedExceptions.get(0).end);
    List<List<GraphTargetItem>> catchedCommands=new ArrayList<>();
    if (code.code.get(endpos).definition instanceof JumpIns) {
      int afterCatchAddr=code.pos2adr(endpos + 1) + code.code.get(endpos).operands[0];
      int afterCatchPos=code.adr2pos(afterCatchAddr);
      Collections.sort(catchedExceptions,new Comparator<ABCException>(){
        @Override public int compare(        ABCException o1,        ABCException o2){
          return code.fixAddrAfterDebugLine(o1.target) - 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 == code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
            if (afterCatchPos + 1 == code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
              AVM2Instruction jmpIns=code.code.get(code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end)));
              if (jmpIns.definition instanceof JumpIns) {
                int finStart=code.adr2pos(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 < code.code.size(); f++) {
                  if (code.code.get(f).definition instanceof LookupSwitchIns) {
                    AVM2Instruction swins=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 ExceptionTreeItem(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);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                if (!switchFound) {
                  finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,null,loops);
                }
                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(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 ExceptionTreeItem(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));
      }
      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);
      output.clear();
      output.add(new TryTreeItem(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));
    }
 else {
      ret.add(lop);
    }
    return ret;
  }
  if (part.nextParts.isEmpty()) {
    if (code.code.get(part.end).definition instanceof ReturnValueIns) {
      if (part.getHeight() >= 3) {
        if (code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) {
          if (code.code.get(part.getPosAt(part.getHeight() - 3)).definition instanceof GetLocalTypeIns) {
            if (output.size() >= 2) {
              if (output.get(output.size() - 2) instanceof SetLocalTreeItem) {
                ret=new ArrayList<>();
                ret.addAll(output);
                ret.remove(ret.size() - 1);
                ret.add(new ReturnValueTreeItem(code.code.get(part.end),((SetLocalTreeItem)output.get(output.size() - 2)).value));
                return ret;
              }
            }
          }
        }
      }
    }
  }
  if (code.code.get(part.end).definition instanceof LookupSwitchIns) {
    ret=new ArrayList<>();
    ret.addAll(output);
    return ret;
  }
  if (((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictEqTreeItem)&& (part.nextParts.get(0).getHeight() >= 2)&& (code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)&& (code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)) || ((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictNeqTreeItem)&& (part.nextParts.get(1).getHeight() >= 2)&& (code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)&& (code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) {
    ret=new ArrayList<>();
    ret.addAll(output);
    boolean reversed=false;
    if (stack.peek() instanceof StrictEqTreeItem) {
      reversed=true;
    }
    GraphTargetItem switchedObject=null;
    if (!output.isEmpty()) {
      if (output.get(output.size() - 1) instanceof SetLocalTreeItem) {
        switchedObject=((SetLocalTreeItem)output.get(output.size() - 1)).value;
      }
    }
    if (switchedObject == null) {
      switchedObject=new NullTreeItem(null);
    }
    HashMap<Integer,GraphTargetItem> caseValuesMap=new HashMap<>();
    GraphTargetItem tar=stack.pop();
    if (tar instanceof StrictEqTreeItem) {
      tar=((StrictEqTreeItem)tar).leftSide;
    }
    if (tar instanceof StrictNeqTreeItem) {
      tar=((StrictNeqTreeItem)tar).leftSide;
    }
    caseValuesMap.put(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 ((code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) {
      part=part.nextParts.get(reversed ? 1 : 0);
      translatePart(localData,part,stack);
      tar=stack.pop();
      if (tar instanceof StrictEqTreeItem) {
        tar=((StrictEqTreeItem)tar).leftSide;
      }
      if (tar instanceof StrictNeqTreeItem) {
        tar=((StrictNeqTreeItem)tar).leftSide;
      }
      if (code.code.get(part.end).definition instanceof IfStrictNeIns) {
        reversed=false;
      }
 else {
        reversed=true;
      }
      caseValuesMap.put(code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(reversed ? 0 : 1).start)).operands[0],tar);
      while (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 (code.code.get(dp.start).definition instanceof JumpIns) {
      if (dp instanceof GraphPartMulti) {
        dp=((GraphPartMulti)dp).parts.get(0);
      }
      dp=dp.nextParts.get(0);
    }
    if (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;
    List<GraphPart> loopContinues=getLoopsContinues(loops);
    next=switchLoc.getNextPartPath(loopContinues);
    if (next == null) {
      next=switchLoc.getNextSuperPartPath(loopContinues);
    }
    GraphTargetItem ti=checkLoop(next,stopPart,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);
      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<>();
      GraphPart nextCase=null;
      nextCase=next;
      if (next != null) {
        if (i < caseBodies.size() - 1) {
          if (!caseBodies.get(i).leadsTo(srcCode,caseBodies.get(i + 1),loops)) {
          }
 else {
            nextCase=caseBodies.get(i + 1);
          }
        }
 else         if (hasDefault) {
          if (!caseBodies.get(i).leadsTo(srcCode,defaultPart,loops)) {
          }
 else {
            nextCase=defaultPart;
          }
        }
      }
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      stopPart2.add(nextCase);
      cc.addAll(0,printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,caseBodies.get(i),stopPart2,loops));
      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));
    }
  }
  return ret;
}

Fixed version (ground truth):
@Override protected List<GraphTargetItem> check(GraphSource srcCode,List<Object> localData,List<GraphPart> allParts,Stack<GraphTargetItem> stack,GraphPart parent,GraphPart part,List<GraphPart> stopPart,List<Loop> loops,List<GraphTargetItem> output,Loop currentLoop){
  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=code.fixAddrAfterDebugLine(code.pos2adr(part.start));
  int maxend=-1;
  List<ABCException> catchedExceptions=new ArrayList<>();
  for (int e=0; e < body.exceptions.length; e++) {
    if (addr == 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=code.fixAddrAfterDebugLine(body.exceptions[e].end);
          catchedExceptions.add(body.exceptions[e]);
        }
 else         if (code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) {
          catchedExceptions.add(body.exceptions[e]);
        }
      }
    }
  }
  if (catchedExceptions.size() > 0) {
    if (currentLoop != null) {
    }
    parsedExceptions.addAll(catchedExceptions);
    int endpos=code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
    int endposStartBlock=code.adr2pos(catchedExceptions.get(0).end);
    List<List<GraphTargetItem>> catchedCommands=new ArrayList<>();
    if (code.code.get(endpos).definition instanceof JumpIns) {
      int afterCatchAddr=code.pos2adr(endpos + 1) + code.code.get(endpos).operands[0];
      int afterCatchPos=code.adr2pos(afterCatchAddr);
      Collections.sort(catchedExceptions,new Comparator<ABCException>(){
        @Override public int compare(        ABCException o1,        ABCException o2){
          return code.fixAddrAfterDebugLine(o1.target) - 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 == code.fixAddrAfterDebugLine(body.exceptions[e].start)) {
            if (afterCatchPos + 1 == code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))) {
              AVM2Instruction jmpIns=code.code.get(code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end)));
              if (jmpIns.definition instanceof JumpIns) {
                int finStart=code.adr2pos(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 < code.code.size(); f++) {
                  if (code.code.get(f).definition instanceof LookupSwitchIns) {
                    AVM2Instruction swins=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 ExceptionTreeItem(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);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                if (!switchFound) {
                  finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,null,loops);
                }
                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(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 ExceptionTreeItem(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));
      }
      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);
      output.clear();
      output.add(new TryTreeItem(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));
    }
 else {
      ret.add(lop);
    }
    return ret;
  }
  if (part.nextParts.isEmpty()) {
    if (code.code.get(part.end).definition instanceof ReturnValueIns) {
      if (part.getHeight() >= 3) {
        if (code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) {
          if (code.code.get(part.getPosAt(part.getHeight() - 3)).definition instanceof GetLocalTypeIns) {
            if (output.size() >= 2) {
              if (output.get(output.size() - 2) instanceof SetLocalTreeItem) {
                ret=new ArrayList<>();
                ret.addAll(output);
                ret.remove(ret.size() - 1);
                ret.add(new ReturnValueTreeItem(code.code.get(part.end),((SetLocalTreeItem)output.get(output.size() - 2)).value));
                return ret;
              }
            }
          }
        }
      }
    }
  }
  if ((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 StrictEqTreeItem)&& (part.nextParts.get(0).getHeight() >= 2)&& (code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(0).start)).definition instanceof PushIntegerTypeIns)&& (code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)) || ((part.nextParts.size() == 2) && (!stack.isEmpty()) && (stack.peek() instanceof StrictNeqTreeItem)&& (part.nextParts.get(1).getHeight() >= 2)&& (code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns)&& (code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) {
    if (stack.peek() instanceof StrictEqTreeItem) {
      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 StrictEqTreeItem) {
      reversed=true;
    }
    GraphTargetItem switchedObject=null;
    if (!output.isEmpty()) {
      if (output.get(output.size() - 1) instanceof SetLocalTreeItem) {
        switchedObject=((SetLocalTreeItem)output.get(output.size() - 1)).value;
      }
    }
    if (switchedObject == null) {
      switchedObject=new NullTreeItem(null);
    }
    HashMap<Integer,GraphTargetItem> caseValuesMap=new HashMap<>();
    GraphTargetItem tar=stack.pop();
    if (tar instanceof StrictEqTreeItem) {
      tar=((StrictEqTreeItem)tar).leftSide;
    }
    if (tar instanceof StrictNeqTreeItem) {
      tar=((StrictNeqTreeItem)tar).leftSide;
    }
    caseValuesMap.put(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 ((code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) || (code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) {
      part=part.nextParts.get(reversed ? 1 : 0);
      translatePart(localData,part,stack);
      tar=stack.pop();
      if (tar instanceof StrictEqTreeItem) {
        tar=((StrictEqTreeItem)tar).leftSide;
      }
      if (tar instanceof StrictNeqTreeItem) {
        tar=((StrictNeqTreeItem)tar).leftSide;
      }
      if (code.code.get(part.end).definition instanceof IfStrictNeIns) {
        reversed=false;
      }
 else {
        reversed=true;
      }
      caseValuesMap.put(code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(reversed ? 0 : 1).start)).operands[0],tar);
      while (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 (code.code.get(dp.start).definition instanceof JumpIns) {
      if (dp instanceof GraphPartMulti) {
        dp=((GraphPartMulti)dp).parts.get(0);
      }
      dp=dp.nextParts.get(0);
    }
    if (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;
    List<GraphPart> loopContinues=getLoopsContinues(loops);
    next=switchLoc.getNextPartPath(loopContinues);
    if (next == null) {
      next=switchLoc.getNextSuperPartPath(loopContinues);
    }
    GraphTargetItem ti=checkLoop(next,stopPart,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);
      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<>();
      GraphPart nextCase=null;
      nextCase=next;
      if (next != null) {
        if (i < caseBodies.size() - 1) {
          if (!caseBodies.get(i).leadsTo(srcCode,caseBodies.get(i + 1),loops)) {
          }
 else {
            nextCase=caseBodies.get(i + 1);
          }
        }
 else         if (hasDefault) {
          if (!caseBodies.get(i).leadsTo(srcCode,defaultPart,loops)) {
          }
 else {
            nextCase=defaultPart;
          }
        }
      }
      List<GraphPart> stopPart2=new ArrayList<>(stopPart);
      stopPart2.add(nextCase);
      cc.addAll(0,printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,caseBodies.get(i),stopPart2,loops));
      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));
    }
  }
  return ret;
}