class InstructionAdapter extends MethodVisitor {

  @Override
  public void visitInsn(final int opcode) {
    switch (opcode) {
      case Opcodes.NOP:
        nop();
        break;
      case Opcodes.ACONST_NULL:
        aconst(null);
        break;
      case Opcodes.ICONST_M1:
      case Opcodes.ICONST_0:
      case Opcodes.ICONST_1:
      case Opcodes.ICONST_2:
      case Opcodes.ICONST_3:
      case Opcodes.ICONST_4:
      case Opcodes.ICONST_5:
        iconst(opcode - Opcodes.ICONST_0);
        break;
      case Opcodes.LCONST_0:
      case Opcodes.LCONST_1:
        lconst((long) (opcode - Opcodes.LCONST_0));
        break;
      case Opcodes.FCONST_0:
      case Opcodes.FCONST_1:
      case Opcodes.FCONST_2:
        fconst((float) (opcode - Opcodes.FCONST_0));
        break;
      case Opcodes.DCONST_0:
      case Opcodes.DCONST_1:
        dconst((double) (opcode - Opcodes.DCONST_0));
        break;
      case Opcodes.IALOAD:
        aload(Type.INT_TYPE);
        break;
      case Opcodes.LALOAD:
        aload(Type.LONG_TYPE);
        break;
      case Opcodes.FALOAD:
        aload(Type.FLOAT_TYPE);
        break;
      case Opcodes.DALOAD:
        aload(Type.DOUBLE_TYPE);
        break;
      case Opcodes.AALOAD:
        aload(OBJECT_TYPE);
        break;
      case Opcodes.BALOAD:
        aload(Type.BYTE_TYPE);
        break;
      case Opcodes.CALOAD:
        aload(Type.CHAR_TYPE);
        break;
      case Opcodes.SALOAD:
        aload(Type.SHORT_TYPE);
        break;
      case Opcodes.IASTORE:
        astore(Type.INT_TYPE);
        break;
      case Opcodes.LASTORE:
        astore(Type.LONG_TYPE);
        break;
      case Opcodes.FASTORE:
        astore(Type.FLOAT_TYPE);
        break;
      case Opcodes.DASTORE:
        astore(Type.DOUBLE_TYPE);
        break;
      case Opcodes.AASTORE:
        astore(OBJECT_TYPE);
        break;
      case Opcodes.BASTORE:
        astore(Type.BYTE_TYPE);
        break;
      case Opcodes.CASTORE:
        astore(Type.CHAR_TYPE);
        break;
      case Opcodes.SASTORE:
        astore(Type.SHORT_TYPE);
        break;
      case Opcodes.POP:
        pop();
        break;
      case Opcodes.POP2:
        pop2();
        break;
      case Opcodes.DUP:
        dup();
        break;
      case Opcodes.DUP_X1:
        dupX1();
        break;
      case Opcodes.DUP_X2:
        dupX2();
        break;
      case Opcodes.DUP2:
        dup2();
        break;
      case Opcodes.DUP2_X1:
        dup2X1();
        break;
      case Opcodes.DUP2_X2:
        dup2X2();
        break;
      case Opcodes.SWAP:
        swap();
        break;
      case Opcodes.IADD:
        add(Type.INT_TYPE);
        break;
      case Opcodes.LADD:
        add(Type.LONG_TYPE);
        break;
      case Opcodes.FADD:
        add(Type.FLOAT_TYPE);
        break;
      case Opcodes.DADD:
        add(Type.DOUBLE_TYPE);
        break;
      case Opcodes.ISUB:
        sub(Type.INT_TYPE);
        break;
      case Opcodes.LSUB:
        sub(Type.LONG_TYPE);
        break;
      case Opcodes.FSUB:
        sub(Type.FLOAT_TYPE);
        break;
      case Opcodes.DSUB:
        sub(Type.DOUBLE_TYPE);
        break;
      case Opcodes.IMUL:
        mul(Type.INT_TYPE);
        break;
      case Opcodes.LMUL:
        mul(Type.LONG_TYPE);
        break;
      case Opcodes.FMUL:
        mul(Type.FLOAT_TYPE);
        break;
      case Opcodes.DMUL:
        mul(Type.DOUBLE_TYPE);
        break;
      case Opcodes.IDIV:
        div(Type.INT_TYPE);
        break;
      case Opcodes.LDIV:
        div(Type.LONG_TYPE);
        break;
      case Opcodes.FDIV:
        div(Type.FLOAT_TYPE);
        break;
      case Opcodes.DDIV:
        div(Type.DOUBLE_TYPE);
        break;
      case Opcodes.IREM:
        rem(Type.INT_TYPE);
        break;
      case Opcodes.LREM:
        rem(Type.LONG_TYPE);
        break;
      case Opcodes.FREM:
        rem(Type.FLOAT_TYPE);
        break;
      case Opcodes.DREM:
        rem(Type.DOUBLE_TYPE);
        break;
      case Opcodes.INEG:
        neg(Type.INT_TYPE);
        break;
      case Opcodes.LNEG:
        neg(Type.LONG_TYPE);
        break;
      case Opcodes.FNEG:
        neg(Type.FLOAT_TYPE);
        break;
      case Opcodes.DNEG:
        neg(Type.DOUBLE_TYPE);
        break;
      case Opcodes.ISHL:
        shl(Type.INT_TYPE);
        break;
      case Opcodes.LSHL:
        shl(Type.LONG_TYPE);
        break;
      case Opcodes.ISHR:
        shr(Type.INT_TYPE);
        break;
      case Opcodes.LSHR:
        shr(Type.LONG_TYPE);
        break;
      case Opcodes.IUSHR:
        ushr(Type.INT_TYPE);
        break;
      case Opcodes.LUSHR:
        ushr(Type.LONG_TYPE);
        break;
      case Opcodes.IAND:
        and(Type.INT_TYPE);
        break;
      case Opcodes.LAND:
        and(Type.LONG_TYPE);
        break;
      case Opcodes.IOR:
        or(Type.INT_TYPE);
        break;
      case Opcodes.LOR:
        or(Type.LONG_TYPE);
        break;
      case Opcodes.IXOR:
        xor(Type.INT_TYPE);
        break;
      case Opcodes.LXOR:
        xor(Type.LONG_TYPE);
        break;
      case Opcodes.I2L:
        cast(Type.INT_TYPE, Type.LONG_TYPE);
        break;
      case Opcodes.I2F:
        cast(Type.INT_TYPE, Type.FLOAT_TYPE);
        break;
      case Opcodes.I2D:
        cast(Type.INT_TYPE, Type.DOUBLE_TYPE);
        break;
      case Opcodes.L2I:
        cast(Type.LONG_TYPE, Type.INT_TYPE);
        break;
      case Opcodes.L2F:
        cast(Type.LONG_TYPE, Type.FLOAT_TYPE);
        break;
      case Opcodes.L2D:
        cast(Type.LONG_TYPE, Type.DOUBLE_TYPE);
        break;
      case Opcodes.F2I:
        cast(Type.FLOAT_TYPE, Type.INT_TYPE);
        break;
      case Opcodes.F2L:
        cast(Type.FLOAT_TYPE, Type.LONG_TYPE);
        break;
      case Opcodes.F2D:
        cast(Type.FLOAT_TYPE, Type.DOUBLE_TYPE);
        break;
      case Opcodes.D2I:
        cast(Type.DOUBLE_TYPE, Type.INT_TYPE);
        break;
      case Opcodes.D2L:
        cast(Type.DOUBLE_TYPE, Type.LONG_TYPE);
        break;
      case Opcodes.D2F:
        cast(Type.DOUBLE_TYPE, Type.FLOAT_TYPE);
        break;
      case Opcodes.I2B:
        cast(Type.INT_TYPE, Type.BYTE_TYPE);
        break;
      case Opcodes.I2C:
        cast(Type.INT_TYPE, Type.CHAR_TYPE);
        break;
      case Opcodes.I2S:
        cast(Type.INT_TYPE, Type.SHORT_TYPE);
        break;
      case Opcodes.LCMP:
        lcmp();
        break;
      case Opcodes.FCMPL:
        cmpl(Type.FLOAT_TYPE);
        break;
      case Opcodes.FCMPG:
        cmpg(Type.FLOAT_TYPE);
        break;
      case Opcodes.DCMPL:
        cmpl(Type.DOUBLE_TYPE);
        break;
      case Opcodes.DCMPG:
        cmpg(Type.DOUBLE_TYPE);
        break;
      case Opcodes.IRETURN:
        areturn(Type.INT_TYPE);
        break;
      case Opcodes.LRETURN:
        areturn(Type.LONG_TYPE);
        break;
      case Opcodes.FRETURN:
        areturn(Type.FLOAT_TYPE);
        break;
      case Opcodes.DRETURN:
        areturn(Type.DOUBLE_TYPE);
        break;
      case Opcodes.ARETURN:
        areturn(OBJECT_TYPE);
        break;
      case Opcodes.RETURN:
        areturn(Type.VOID_TYPE);
        break;
      case Opcodes.ARRAYLENGTH:
        arraylength();
        break;
      case Opcodes.ATHROW:
        athrow();
        break;
      case Opcodes.MONITORENTER:
        monitorenter();
        break;
      case Opcodes.MONITOREXIT:
        monitorexit();
        break;
      default:
        throw new IllegalArgumentException();
    }
  }

  public  InstructionAdapter(final MethodVisitor methodVisitor);
  protected  InstructionAdapter(final int api, final MethodVisitor methodVisitor);

}