code: function divmod (q, r, n, d, t) {
          n = n | 0;
          t = t | 0;
  
          var rn = 0;
          var dt = (d[t - 1] & 0xFF) << 8;
          if (t > 1)
              dt |= (d[t - 2] & 0xFF);
  
          while (n-- >= t) {
              var z = (rn << 16) | ((r[n] & 0xFF) << 8);
              if (n > 0)
                  z |= (r[n - 1] & 0xFF);
  
              var i = n - t + 1;
              z /= dt;
              rn += mula_small(r, r, i, d, t, -z);
              q[i] = (z + rn) & 0xFF;
              /* rn is 0 or -1 (underflow) */
              mula_small(r, r, i, d, t, -rn);
              rn = r[n] & 0xFF;
              r[n] = 0;
          }
  
          r[t-1] = rn & 0xFF;
      }
docs: /* divide r (size n) by d (size t), returning quotient q and remainder r
  quotient is size n-t+1, remainder is size t
  requires t > 0 && d[t-1] !== 0
  requires that r[-1] and d[-1] are valid memory locations
  q may overlap with r+t