@Override
  public void translate(
      boolean isStatic,
      int scriptIndex,
      int classIndex,
      HashMap<Integer, GraphTargetItem> localRegs,
      TranslateStack stack,
      ScopeStack scopeStack,
      AVM2ConstantPool constants,
      AVM2Instruction ins,
      List<MethodInfo> method_info,
      List<GraphTargetItem> output,
      MethodBody body,
      ABC abc,
      HashMap<Integer, String> localRegNames,
      List<DottedChain> fullyQualifiedNames,
      String path,
      HashMap<Integer, Integer> localRegsAssignmentIps,
      int ip,
      HashMap<Integer, List<Integer>> refs,
      AVM2Code code) {
    int slotIndex = ins.operands[0];
    GraphTargetItem value = stack.pop();
    GraphTargetItem obj = stack.pop(); // scopeId
    GraphTargetItem objnoreg = obj;
    obj = obj.getThroughRegister();
    Multiname slotname = null;
    if (obj instanceof NewActivationAVM2Item) {
      ((NewActivationAVM2Item) obj).slots.put(slotIndex, value);
    }

    if (obj instanceof ExceptionAVM2Item) {
      slotname = constants.getMultiname(((ExceptionAVM2Item) obj).exception.name_index);
    } else if (obj instanceof ClassAVM2Item) {
      slotname = ((ClassAVM2Item) obj).className;
    } else if (obj instanceof ThisAVM2Item) {
      slotname = ((ThisAVM2Item) obj).className;
    } else if (obj instanceof ScriptAVM2Item) {
      for (int t = 0;
          t < abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.size();
          t++) {
        Trait tr = abc.script_info.get(((ScriptAVM2Item) obj).scriptIndex).traits.traits.get(t);
        if (tr instanceof TraitWithSlot) {
          if (((TraitWithSlot) tr).getSlotIndex() == slotIndex) {
            slotname = tr.getName(abc);
          }
        }
      }
    } else if (obj instanceof NewActivationAVM2Item) {

      for (int t = 0; t < body.traits.traits.size(); t++) {
        if (body.traits.traits.get(t) instanceof TraitWithSlot) {
          if (((TraitWithSlot) body.traits.traits.get(t)).getSlotIndex() == slotIndex) {
            slotname = body.traits.traits.get(t).getName(abc);
          }
        }
      }
    }

    if (slotname != null) {
      if (value instanceof LocalRegAVM2Item) {
        LocalRegAVM2Item lr = (LocalRegAVM2Item) value;
        String slotNameStr = slotname.getName(constants, fullyQualifiedNames, true);
        if (localRegNames.containsKey(lr.regIndex)) {
          if (localRegNames.get(lr.regIndex).equals(slotNameStr)) {
            return; // Register with same name to slot
          }
        }
      }
    }

    if (value.getNotCoerced().getThroughDuplicate() instanceof IncrementAVM2Item) {
      GraphTargetItem inside =
          ((IncrementAVM2Item) value.getNotCoerced())
              .value
              .getThroughRegister()
              .getNotCoerced()
              .getThroughDuplicate();
      if (inside instanceof GetSlotAVM2Item) {
        GetSlotAVM2Item slotItem = (GetSlotAVM2Item) inside;
        if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister())
            && (slotItem.slotName == slotname)) {
          if (stack.size() > 0) {
            GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
            if (top == inside) {
              stack.pop();
              stack.push(new PostIncrementAVM2Item(ins, inside));
            } else if ((top instanceof IncrementAVM2Item)
                && (((IncrementAVM2Item) top).value == inside)) {
              stack.pop();
              stack.push(new PreIncrementAVM2Item(ins, inside));
            } else {
              output.add(new PostIncrementAVM2Item(ins, inside));
            }
          } else {
            output.add(new PostIncrementAVM2Item(ins, inside));
          }
          return;
        }
      }
    }

    if (value.getNotCoerced().getThroughDuplicate() instanceof DecrementAVM2Item) {
      GraphTargetItem inside =
          ((DecrementAVM2Item) value.getNotCoerced())
              .value
              .getThroughRegister()
              .getNotCoerced()
              .getThroughDuplicate();
      if (inside instanceof GetSlotAVM2Item) {
        GetSlotAVM2Item slotItem = (GetSlotAVM2Item) inside;
        if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister())
            && (slotItem.slotName == slotname)) {
          if (stack.size() > 0) {
            GraphTargetItem top = stack.peek().getNotCoerced().getThroughDuplicate();
            if (top == inside) {
              stack.pop();
              stack.push(new PostDecrementAVM2Item(ins, inside));
            } else if ((top instanceof DecrementAVM2Item)
                && (((DecrementAVM2Item) top).value == inside)) {
              stack.pop();
              stack.push(new PreDecrementAVM2Item(ins, inside));
            } else {
              output.add(new PostDecrementAVM2Item(ins, inside));
            }
          } else {
            output.add(new PostDecrementAVM2Item(ins, inside));
          }
          return;
        }
      }
    }

    output.add(new SetSlotAVM2Item(ins, obj, slotname, value));
  }