int quotient_(int x, int y) {
  int xType;
  int yType;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if ((xType == INTEGERSUBTYPE) && (yType == INTEGERSUBTYPE))
    return
      make_integer(
        get_integer_val(x) /
        get_integer_val(y));
  else {
    notinteger();
    return 0; // return not reached
  }
}

int scheme_style_mod(int x, int y) {
  int ret;
  ret = abs(x) % abs(y);
  if (x < 0)
    ret= -ret;
  return ret;
}

int remainder_(int x, int y) {
  int xType;
  int yType;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if ((xType == INTEGERSUBTYPE) && (yType == INTEGERSUBTYPE))
    return
      make_integer(
        scheme_style_mod(get_integer_val(x),
                         get_integer_val(y)));
  else {
    notinteger();
    return 0; // return not reached
  }
}

int modulo_(int x, int y) {
  int xType;
  int yType;
  int i;
  int j;
  int return_;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if ((xType == INTEGERSUBTYPE) && (yType == INTEGERSUBTYPE)) {
    i = get_integer_val(x);
    j = get_integer_val(y);
    return_ = scheme_style_mod(i, j);
    if (return_ * j < 0) {
      j = abs(j);
      if (return_ > 0)
        return_ = return_ - j;
      else
        return_ = return_ + j;
    }
    return make_integer(return_);
  }
  else {
    notinteger();
    return 0; // return not reached
  }
}

int arithmeticshift(int x, int y) {
  int xType;
  int yType;
  int val;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if ((xType == INTEGERSUBTYPE) && (yType == INTEGERSUBTYPE)) {
    val = get_integer_val(y);
    if (val < 0)
      return
        make_integer(
          get_integer_val(x) >>
          -val);
    else
      return
        make_integer(
          get_integer_val(x) <<
          val);
  }
  else {
    notinteger();
    return 0; // return not reached
  }
}

int bitwiseand(int x, int y) {
  int xType;
  int yType;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if (xType == INTEGERSUBTYPE && yType == INTEGERSUBTYPE)
    return
      make_integer(
        get_integer_val(x) &
        get_integer_val(y));
  else {
    notinteger();
    return 0; // return not reached
  }
}

int bitwiseor(int x, int y) {
  int xType;
  int yType;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if (xType == INTEGERSUBTYPE && yType == INTEGERSUBTYPE)
    return
      make_integer(
        get_integer_val(x) |
        get_integer_val(y));
  else {
    notinteger();
    return 0; // return not reached
  }
}

int bitwisexor(int x, int y) {
  int xType;
  int yType;
  arenumbersvectors(x, y);
  xType = MgetVecSubtype(x);
  yType = MgetVecSubtype(y);
  if (xType == INTEGERSUBTYPE && yType == INTEGERSUBTYPE)
    return
      make_integer(
        get_integer_val(x) ^
        get_integer_val(y));
  else {
    notinteger();
    return 0; // return not reached
  }
}
