What could be complexity of this?

while dividend >= divisor:
temp, i = divisor, 1
while dividend >= temp:
dividend -= temp
res += i
i <<= 1
temp <<= 1

If inner loop runs for say x times, then D gets doubled x times so that

D*2^x > N => x > log(N/D) => O(log(N/D))

And about outer loop

N = 2^x * D + M => such that N > M > D

So next time inner loop will run for log(M/D)

So its basically

log(N/D) + log(M/D) + log(L/D) + ..... + log(D/D) => log(N/D) * Y

If someone can help simplify for Y, it would be great