/******************************************************************************
*									      *
*  COMPUTE MERTENS FUNCTION (Deleglise & Rivat's algorithm)                   *
*  10/16/15 (dkc)							      *
*									      *
******************************************************************************/
#include <math.h>
void div64_32(unsigned int *dividend, unsigned int *quotient,
	      unsigned int divisor);
double nuhic(unsigned int x1, unsigned int x2, unsigned int u, char *mob, int *M) {
unsigned int i,j,m,X[2],Q[2],R[2],index;
double temp,temp1,sumb;
X[0]=x1;
X[1]=x2;
sumb=0.0;
for (m=1; m<=u; m++) {
   temp=(double)mob[m-1];
   div64_32(X,Q,m);
   if (Q[0]!=0) 			// doesn't handle very large N values
      return(2000000000.0);
   temp1=(double)Q[0]*65536.0*65536.0;
   temp1=temp1+(double)Q[1];
   temp1=temp1/10000.0;
   j=(unsigned int)(sqrt(temp1)*100.0);
   j=j+1;
// k=x/m;
   for (i=j; i<=Q[1]; i++) {
      div64_32(X,R,m*i);	      // m*i may overflow
      index=R[1];
//    sumb=sumb+temp*(double)M[x/(m*i)-1];
      sumb=sumb+temp*(double)M[index-1];
      }
   }
return(sumb);
}