unsigned int dig; int      bit;
int      dig, bit;
mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c){  mp_int   s, x;  mp_err   res;  mp_digit d;  unsigned int dig;  int      bit;  ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG);  if(mp_cmp_z(b) < 0)    return MP_RANGE;  if((res = mp_init(&s)) != MP_OKAY)    return res;  mp_set(&s, 1);  if((res = mp_init_copy(&x, a)) != MP_OKAY)    goto X;  /* Loop over low-order digits in ascending order */  for(dig = 0; dig < (USED(b) - 1); dig++) {    d = DIGIT(b, dig);    /* Loop over bits of each non-maximal digit */    for(bit = 0; bit < DIGIT_BIT; bit++) {      if(d & 1) {	if((res = s_mp_mul(&s, &x)) != MP_OKAY) 	  goto CLEANUP;      }      d >>= 1;            if((res = s_mp_sqr(&x)) != MP_OKAY)	goto CLEANUP;    }  }  /* Consider now the last digit... */  d = DIGIT(b, dig);  while(d) {    if(d & 1) {      if((res = s_mp_mul(&s, &x)) != MP_OKAY)	goto CLEANUP;    }    d >>= 1;    if((res = s_mp_sqr(&x)) != MP_OKAY)      goto CLEANUP;  }    if(mp_iseven(b))    SIGN(&s) = SIGN(a);  res = mp_copy(&s, c);CLEANUP:  mp_clear(&x);X:  mp_clear(&s);  return res;} /* end mp_expt() */