static void div64(uint64_t *plow, uint64_t *phigh, uint64_t b)

{

    uint64_t q, r, a1, a0;

    int i, qb;



    a0 = *plow;

    a1 = *phigh;

    if (a1 == 0) {

        q = a0 / b;

        r = a0 % b;

        *plow = q;

        *phigh = r;

    } else {

        /* XXX: use a better algorithm */

        for(i = 0; i < 64; i++) {

            a1 = (a1 << 1) | (a0 >> 63);

            if (a1 >= b) {

                a1 -= b;

                qb = 1;

            } else {

                qb = 0;

            }

            a0 = (a0 << 1) | qb;

        }

#if defined(DEBUG_MULDIV)

        printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n",

               *phigh, *plow, b, a0, a1);

#endif

        *plow = a0;

        *phigh = a1;

    }

}

static void div64(uint64_t *plow, uint64_t *phigh, uint64_t b)

{

    uint64_t q, r, a1, a0;

    int i, qb;



    a0 = *plow;

    a1 = *phigh;

    if (a1 == 0) {

        q = a0 / b;

        r = a0 % b;

        *plow = q;

        *phigh = r;

    } else {

        

        for(i = 0; i < 64; i++) {

            a1 = (a1 << 1) | (a0 >> 63);

            if (a1 >= b) {

                a1 -= b;

                qb = 1;

            } else {

                qb = 0;

            }

            a0 = (a0 << 1) | qb;

        }

#if defined(DEBUG_MULDIV)

        printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n",

               *phigh, *plow, b, a0, a1);

#endif

        *plow = a0;

        *phigh = a1;

    }

}

static void div64(uint64_t *plow, uint64_t *phigh, uint64_t b)
static void FUNC_0(uint64_t *VAR_0, uint64_t *VAR_1, uint64_t VAR_2)

{

    uint64_t q, r, a1, a0;

    int VAR_3, VAR_4;



    a0 = *VAR_0;

    a1 = *VAR_1;

    if (a1 == 0) {

        q = a0 / VAR_2;

        r = a0 % VAR_2;

        *VAR_0 = q;

        *VAR_1 = r;

    } else {

        

        for(VAR_3 = 0; VAR_3 < 64; VAR_3++) {

            a1 = (a1 << 1) | (a0 >> 63);

            if (a1 >= VAR_2) {

                a1 -= VAR_2;

                VAR_4 = 1;

            } else {

                VAR_4 = 0;

            }

            a0 = (a0 << 1) | VAR_4;

        }

#if defined(DEBUG_MULDIV)

        printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n",

               *VAR_1, *VAR_0, VAR_2, a0, a1);

#endif

        *VAR_0 = a0;

        *VAR_1 = a1;

    }

}

static void FUNC_0(uint64_t *VAR_0, uint64_t *VAR_1, uint64_t VAR_2)
{ uint64_t q, r, a1, a0; int VAR_3, VAR_4; a0 = *VAR_0; a1 = *VAR_1; if (a1 == 0) { q = a0 / VAR_2; r = a0 % VAR_2; *VAR_0 = q; *VAR_1 = r; } else { for(VAR_3 = 0; VAR_3 < 64; VAR_3++) { a1 = (a1 << 1) | (a0 >> 63); if (a1 >= VAR_2) { a1 -= VAR_2; VAR_4 = 1; } else { VAR_4 = 0; } a0 = (a0 << 1) | VAR_4; } #if defined(DEBUG_MULDIV)
printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n",
*VAR_1, *VAR_0, VAR_2, a0, a1); #endif
*VAR_0 = a0; *VAR_1 = a1; } }