protected Stack<Operation> handleEqualSizeStack(
      Operation jumpCondition, Stack<Operation> beforeStack, Stack<Operation> afterStack) {
    int size = beforeStack.size();
    int unequalItems = 0;
    for (int j = size - 1; j >= 0; j--) {
      logger.debug("CHK(PREV<->NEXT): " + beforeStack.get(j) + " <-> " + afterStack.get(j));
      if (!beforeStack.get(j).equals(afterStack.get(j))) {
        Assert.isTrue(j == size - 1); // allow only stack-top items to be unequal
        unequalItems++;
      }
    }

    logger.debug("Unequal items = " + unequalItems);

    // Handle only 1 unequal item
    Assert.isTrue(unequalItems == 1);

    // Handle only boolean operations
    if (!(beforeStack.peek() instanceof BooleanOperation)) {
      //			throw new IllegalArgumentException("Not boolean: "+beforeStack.peek());
      logger.error("Not boolean: " + beforeStack.peek());
    }
    if (!(afterStack.peek() instanceof BooleanOperation)) {
      //			throw new IllegalArgumentException("Not boolean: "+afterStack.peek());
      logger.error("Not boolean: " + afterStack.peek());
    }

    logger.debug("Try to simplify if condition...");
    /*

    condition = a
    before stack = b
    after stack = c
    a&&b || !a&&c

    */
    Stack<Operation> newExecutionStack = copyExecutionStack(afterStack);
    if (jumpCondition.equals(beforeStack.peek())) {
      // a&&a || !a&&c = a || !a&&c = a||c;
      logger.debug("Simplifying to OR");
      Operation nextStackValue = newExecutionStack.pop();
      newExecutionStack.push(new OrOperation(jumpCondition, nextStackValue));
    } else if (jumpCondition.equals(new NotOperation(beforeStack.peek()))) {
      // a&&!a || !a&&c = 0 || !a&&c = !a&&c
      logger.debug("Simplifying to AND");
      Operation nextStackValue = newExecutionStack.pop();
      newExecutionStack.push(
          AndOperation.createInstance(new NotOperation(jumpCondition), nextStackValue));
    } else {
      logger.debug("Simplifying to TERNARY");
      //			Operation op1 = AndOperation.createInstance(jumpCondition,beforeStack.peek());
      //			Operation op2 = AndOperation.createInstance(new
      // NotOperation(jumpCondition),newExecutionStack.pop());
      //			newExecutionStack.push(BranchOperation.createInstance(op1, op2));
      newExecutionStack.push(
          new TernaryOperation(jumpCondition, beforeStack.peek(), newExecutionStack.pop()));
    }

    return newExecutionStack;
  }
 public String getStringValue(int level) {
   return new StringBuffer()
       .append(CodeUtil.getIndent(level))
       .append("duplicateMovieClip(")
       .append(source.getStringValue(level))
       .append(",")
       .append(target.getStringValue(level))
       .append(",")
       .append(depth.getStringValue(level))
       .append(")")
       .toString();
 }