// integer numeric binary arithmetic functions

void exec_div() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE) {
      stack_arg1 =
        make_integer(
          Mintvecref(temp) /
          Mintvecref(temp2));
      MPop();
      MSetStackArg1(stack_arg1);
    }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_add() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE) {
      stack_arg1 =
        make_integer(
          Mintvecref(temp) +
          Mintvecref(temp2));
      MPop();
      MSetStackArg1(stack_arg1);
    }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_sub() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE) {
      stack_arg1 =
        make_integer(
          Mintvecref(temp) -
          Mintvecref(temp2));
      MPop();
      MSetStackArg1(stack_arg1);
    }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_mult() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE) {
      stack_arg1 =
        make_integer(
          Mintvecref(temp) *
          Mintvecref(temp2));
      MPop();
      MSetStackArg1(stack_arg1);
    }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_eq() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE)
      if (Mintvecref(temp) == Mintvecref(temp2)) {
        MPop();
        MSetStackArg1(Mtrue);
      }
      else {
        MPop();
        MSetStackArg1(Mfalse);
      }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_lt() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE)
      if (Mintvecref(temp) < Mintvecref(temp2)) {
        MPop();
        MSetStackArg1(Mtrue);
      }
      else {
        MPop();
        MSetStackArg1(Mfalse);
      }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_le() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE)
      if (Mintvecref(temp) <= Mintvecref(temp2)) {
        MPop();
        MSetStackArg1(Mtrue);
      }
      else {
        MPop();
        MSetStackArg1(Mfalse);
      }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_gt() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE)
      if (Mintvecref(temp) > Mintvecref(temp2)) {
        MPop();
        MSetStackArg1(Mtrue);
      }
      else {
        MPop();
        MSetStackArg1(Mfalse);
      }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}

void exec_ge() {
  int temp;
  int temp2;

  temp = MStackArg2Ref();
  temp2 = MStackArg1Ref();

  arenumbersvectors(temp, temp2);

  if (MgetVecSubtype(temp) == INTEGERSUBTYPE) {
    if (MgetVecSubtype(temp2) == INTEGERSUBTYPE)
      if (Mintvecref(temp) >= Mintvecref(temp2)) {
        MPop();
        MSetStackArg1(Mtrue);
      }
      else {
        MPop();
        MSetStackArg1(Mfalse);
      }
    else
      notnumber();
  }
  else
    notnumber();
  MNextInstruction();
  return;
}
