12.13.2 Multiply and Add "32-bit int * 32-bit int + 64-bit long long = 64-bit long long int"

To perform multiplication and addition, cast the 32-bit integer to 64-bit (long long) and then perform multiplication and addition as follows.

Example:

  long long test (int a, int b, long long c)
  {
    return c + (long long) a * b;
  }
# Illustrative generated assembly with optimizations
test:
  mtlo $6
  mthi $7
  madd $4, $5
  mflo $2 
  mfhi $3 
  j $31