int divideHelper(int a, int b) {
        if (a > b)
            return 0;
        if (a == b)
            return 1;

        // shift b to align a and compare with a
        int diff = bitDiff(a, b);
        if (a < (b << diff))
            return (1 << diff) + divideHelper(a - (b << diff), b);
        diff--;
        return (1 << diff) + divideHelper(a - (b << diff), b);
    }