Program: 62195
Project: 62195
Buggy source:
@Override protected List<GraphTargetItem> check(GraphSource srcCode,List localData,List<GraphPart> allParts,Stack<GraphTargetItem> stack,GraphPart parent,GraphPart part,GraphPart stopPart,List<Loop> loops,List<GraphTargetItem> output,HashMap<Loop,List<GraphTargetItem>> forFinalCommands){
  List<GraphTargetItem> ret=null;
  List<ABCException> parsedExceptions=(List<ABCException>)localData.get(DATA_PARSEDEXCEPTIONS);
  List<Integer> finallyJumps=(List<Integer>)localData.get(DATA_FINALLYJUMPS);
  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<ABCException>();
  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) {
    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<List<GraphTargetItem>>();
    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<GraphTargetItem>();
      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);
                          finallyCommands=printGraph(localData,stack,allParts,parent,fpart,fepart,loops,forFinalCommands);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                if (!switchFound) {
                  finallyCommands=printGraph(localData,stack,allParts,parent,fpart,null,loops,forFinalCommands);
                }
                finallyJumps.add(finStart);
                break;
              }
            }
          }
        }
      }
      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;
            break;
          }
        }
        GraphPart nepart=null;
        for (        GraphPart p : allParts) {
          if (p.start == eendpos + 1) {
            nepart=p;
            break;
          }
        }
        stack.add(new ExceptionTreeItem(catchedExceptions.get(e)));
        List localData2=new ArrayList();
        localData2.addAll(localData);
        localData2.set(DATA_SCOPESTACK,new Stack<GraphTargetItem>());
        catchedCommands.add(printGraph(localData2,stack,allParts,parent,npart,nepart,loops,forFinalCommands));
      }
      GraphPart nepart=null;
      for (      GraphPart p : allParts) {
        if (p.start == endposStartBlock) {
          nepart=p;
          break;
        }
      }
      List<GraphTargetItem> tryCommands=printGraph(localData,stack,allParts,parent,part,nepart,loops,forFinalCommands);
      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<GraphTargetItem>();
    ret.addAll(output);
    GraphTargetItem lop=checkLoop(part,stopPart,loops);
    if (lop == null) {
      ret.addAll(printGraph(localData,stack,allParts,null,part,stopPart,loops,forFinalCommands));
    }
 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<GraphTargetItem>();
                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<GraphTargetItem>();
    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<GraphTargetItem>();
    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<Integer,GraphTargetItem>();
    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);
    }
    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<GraphTargetItem>();
    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<List<GraphTargetItem>>();
    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);
    Loop currentLoop=new Loop(loops.size(),null,next);
    loops.add(currentLoop);
    List<Integer> valuesMapping=new ArrayList<Integer>();
    List<GraphPart> caseBodies=new ArrayList<GraphPart>();
    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<GraphTargetItem>();
    GraphPart defaultPart=null;
    if (hasDefault) {
      defaultPart=switchLoc.nextParts.get(switchLoc.nextParts.size() - 1);
      defaultCommands=printGraph(localData,stack,allParts,switchLoc,defaultPart,next,loops,forFinalCommands);
    }
    List<GraphPart> ignored=new ArrayList<GraphPart>();
    for (    Loop l : loops) {
      ignored.add(l.loopContinue);
    }
    for (int i=0; i < caseBodies.size(); i++) {
      List<GraphTargetItem> cc=new ArrayList<GraphTargetItem>();
      GraphPart nextCase=null;
      nextCase=next;
      if (next != null) {
        if (i < caseBodies.size() - 1) {
          if (!caseBodies.get(i).leadsTo(srcCode,caseBodies.get(i + 1),ignored)) {
            cc.add(new BreakItem(null,currentLoop.id));
          }
 else {
            nextCase=caseBodies.get(i + 1);
          }
        }
 else         if (hasDefault) {
          if (!caseBodies.get(i).leadsTo(srcCode,defaultPart,ignored)) {
            cc.add(new BreakItem(null,currentLoop.id));
          }
 else {
            nextCase=defaultPart;
          }
        }
      }
      cc.addAll(0,printGraph(localData,stack,allParts,switchLoc,caseBodies.get(i),nextCase,loops,forFinalCommands));
      caseCommands.add(cc);
    }
    SwitchItem sti=new SwitchItem(null,currentLoop,switchedObject,caseValues,caseCommands,defaultCommands,valuesMapping);
    ret.add(sti);
    loops.remove(currentLoop);
    if (next != null) {
      if (ti != null) {
        ret.add(ti);
      }
 else {
        ret.addAll(printGraph(localData,stack,allParts,null,next,stopPart,loops,forFinalCommands));
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
@Override protected List<GraphTargetItem> check(GraphSource srcCode,List localData,List<GraphPart> allParts,Stack<GraphTargetItem> stack,GraphPart parent,GraphPart part,GraphPart stopPart,List<Loop> loops,List<GraphTargetItem> output,HashMap<Loop,List<GraphTargetItem>> forFinalCommands){
  List<GraphTargetItem> ret=null;
  List<ABCException> parsedExceptions=(List<ABCException>)localData.get(DATA_PARSEDEXCEPTIONS);
  List<Integer> finallyJumps=(List<Integer>)localData.get(DATA_FINALLYJUMPS);
  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<ABCException>();
  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) {
    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<List<GraphTargetItem>>();
    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<GraphTargetItem>();
      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);
                          finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,fepart,loops,forFinalCommands);
                          returnPos=f + 1;
                          break;
                        }
                      }
                    }
                  }
                }
                if (!switchFound) {
                  finallyCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,fpart,null,loops,forFinalCommands);
                }
                finallyJumps.add(finStart);
                break;
              }
            }
          }
        }
      }
      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;
            break;
          }
        }
        GraphPart nepart=null;
        for (        GraphPart p : allParts) {
          if (p.start == eendpos + 1) {
            nepart=p;
            break;
          }
        }
        stack.add(new ExceptionTreeItem(catchedExceptions.get(e)));
        List localData2=new ArrayList();
        localData2.addAll(localData);
        localData2.set(DATA_SCOPESTACK,new Stack<GraphTargetItem>());
        catchedCommands.add(printGraph(new ArrayList<GraphPart>(),localData2,stack,allParts,parent,npart,nepart,loops,forFinalCommands));
      }
      GraphPart nepart=null;
      for (      GraphPart p : allParts) {
        if (p.start == endposStartBlock) {
          nepart=p;
          break;
        }
      }
      List<GraphTargetItem> tryCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,parent,part,nepart,loops,forFinalCommands);
      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<GraphTargetItem>();
    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,forFinalCommands));
    }
 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<GraphTargetItem>();
                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<GraphTargetItem>();
    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<GraphTargetItem>();
    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<Integer,GraphTargetItem>();
    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);
    }
    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<GraphTargetItem>();
    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<List<GraphTargetItem>>();
    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);
    Loop currentLoop=new Loop(loops.size(),null,next);
    loops.add(currentLoop);
    List<Integer> valuesMapping=new ArrayList<Integer>();
    List<GraphPart> caseBodies=new ArrayList<GraphPart>();
    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<GraphTargetItem>();
    GraphPart defaultPart=null;
    if (hasDefault) {
      defaultPart=switchLoc.nextParts.get(switchLoc.nextParts.size() - 1);
      defaultCommands=printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,defaultPart,next,loops,forFinalCommands);
    }
    List<GraphPart> ignored=new ArrayList<GraphPart>();
    for (    Loop l : loops) {
      ignored.add(l.loopContinue);
    }
    for (int i=0; i < caseBodies.size(); i++) {
      List<GraphTargetItem> cc=new ArrayList<GraphTargetItem>();
      GraphPart nextCase=null;
      nextCase=next;
      if (next != null) {
        if (i < caseBodies.size() - 1) {
          if (!caseBodies.get(i).leadsTo(srcCode,caseBodies.get(i + 1),ignored)) {
            cc.add(new BreakItem(null,currentLoop.id));
          }
 else {
            nextCase=caseBodies.get(i + 1);
          }
        }
 else         if (hasDefault) {
          if (!caseBodies.get(i).leadsTo(srcCode,defaultPart,ignored)) {
            cc.add(new BreakItem(null,currentLoop.id));
          }
 else {
            nextCase=defaultPart;
          }
        }
      }
      cc.addAll(0,printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,switchLoc,caseBodies.get(i),nextCase,loops,forFinalCommands));
      caseCommands.add(cc);
    }
    SwitchItem sti=new SwitchItem(null,currentLoop,switchedObject,caseValues,caseCommands,defaultCommands,valuesMapping);
    ret.add(sti);
    loops.remove(currentLoop);
    if (next != null) {
      if (ti != null) {
        ret.add(ti);
      }
 else {
        ret.addAll(printGraph(new ArrayList<GraphPart>(),localData,stack,allParts,null,next,stopPart,loops,forFinalCommands));
      }
    }
  }
  return ret;
}